Skip to content

Commit

Permalink
Remove support for old versions of Python and Ansible (#1261)
Browse files Browse the repository at this point in the history
* Remove Support for Ansible < 2.15 and Python < 3.9
  • Loading branch information
pyrodie18 authored Jun 3, 2024
1 parent ef93508 commit f701aa0
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 60 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python 3.9
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11

- name: Install dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/javagateway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python 3.9
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11

- name: Install dependencies
run: |
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/plugins-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,21 @@ jobs:
- version: "6.4"
ansible:
# https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-changelogs
- stable-2.12
- stable-2.13
- stable-2.14
- stable-2.15
- stable-2.16
- devel
python:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
exclude:
- ansible: stable-2.15
python: '3.12'
- ansible: stable-2.16
python: '3.9'
- ansible: devel
python: '3.9'

steps:
- name: Check out code
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python 3.9
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11

- name: Install dependencies
run: |
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/repo-sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,11 @@ jobs:
# Testing against `devel` may fail as new tests are added.

# https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-changelogs
- stable-2.12
- stable-2.13
- stable-2.14
- stable-2.15
- stable-2.16
- devel
python:
- '3.10'
- '3.11'
runs-on: ubuntu-latest
steps:
# ansible-test requires the collection to be in a directory in the form
Expand All @@ -58,7 +55,7 @@ jobs:
path: ansible_collections/community/zabbix

- name: Set up Python ${{ matrix.ansible }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python 3.9
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11

- name: Install dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python 3.9
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11

- name: Install dependencies
run: |
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,21 @@ Click on the name of a plugin or module to view that content's documentation:

### Requirements

Each component in this collection requires additional dependencies. Review components you are interested in by visiting links present in the [Included content](#included-content) section.
Some of the components in this collection requires additional dependencies. Review components you are interested in by visiting links present in the [Included content](#included-content) section.

This is especially important for some of the Zabbix roles that require you to **install additional standalone roles** from Ansible Galaxy.
While the various roles and modules may work with earlier versions of Python and Ansible, they are only tested and maintained against Ansible Core >= 2.15 and python >= 3.9

For the majority of modules, however, you can get away with just:
#### External Collections

#### Ansible 2.10 and higher
Additional collections may be required when running the various roles.

* `ansible.posix`: Required if using SELinux portion of any roles
* `ansible.general`: Required if using SELinux portion of any roles
* `ansible.netcommon`: Required when using the agent role
* `community.mysql`: Required for the proxy or server roles if using MySQL
* `community.postgresql`: Required for the proxy or server roles if using PostgreSQL
* `community.windows`: Required for the agent role if installing on Windows

With the release of Ansible 2.10, modules have been moved into collections. With the exception of ansible.builtin modules, this means additonal collections must be installed in order to use modules such as seboolean (now ansible.posix.seboolean). The following collections are now frequently required: `ansible.posix` and `community.general`. Installing the collections:

```bash
ansible-galaxy collection install ansible.posix
Expand Down
2 changes: 2 additions & 0 deletions changelogs/fragments/remove_old_ansible.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
breaking_changes:
- Remove support for Ansible < 2.15 and Python < 3.9
7 changes: 0 additions & 7 deletions molecule/zabbix_javagateway/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,9 @@
when:
- ansible_os_family != 'RedHat'

- name: Check if warn parameter can be used for shell module
ansible.builtin.set_fact:
produce_warn: False
when: ansible_version.full is version("2.14", "<")

# https://github.com/geerlingguy/ansible-role-java/issues/64
- name: "Apt update"
ansible.builtin.shell: "apt-get update && mkdir -p /usr/share/man/man1"
args:
warn: "{{ produce_warn | default(omit) }}"
register: installation_dependencies
until: installation_dependencies is succeeded
when:
Expand Down
7 changes: 0 additions & 7 deletions molecule/zabbix_proxy/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,8 @@
when:
- ansible_os_family == 'RedHat'

- name: Check if warn parameter can be used for shell module
ansible.builtin.set_fact:
produce_warn: False
when: ansible_version.full is version("2.14", "<")

- name: "Apt update"
ansible.builtin.shell: "apt-get update && echo exit 0 > /usr/sbin/policy-rc.d"
args:
warn: "{{ produce_warn | default(omit) }}"
register: installation_dependencies
until: installation_dependencies is succeeded
when:
Expand Down
7 changes: 0 additions & 7 deletions molecule/zabbix_server/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,8 @@
- ansible_os_family == 'RedHat'
- inventory_hostname in groups['mysql']

- name: Check if warn parameter can be used for shell module
ansible.builtin.set_fact:
produce_warn: false
when: ansible_version.full is version("2.14", "<")

- name: "Apt update"
ansible.builtin.shell: "apt-get update && echo exit 0 > /usr/sbin/policy-rc.d"
args:
warn: "{{ produce_warn | default(omit) }}"
register: installation_dependencies
until: installation_dependencies is succeeded
when:
Expand Down
7 changes: 0 additions & 7 deletions molecule/zabbix_web/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,8 @@
- ansible_os_family == 'RedHat'
- inventory_hostname in groups['mysql']

- name: Check if warn parameter can be used for shell module
ansible.builtin.set_fact:
produce_warn: false
when: ansible_version.full is version("2.14", "<")

- name: "Apt update"
ansible.builtin.shell: "apt-get update"
args:
warn: "{{ produce_warn | default(omit) }}"
register: installation_dependencies
until: installation_dependencies is succeeded
when:
Expand Down
7 changes: 0 additions & 7 deletions roles/zabbix_agent/tasks/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@
tags:
- install

- name: Check if warn parameter can be used for shell module
ansible.builtin.set_fact:
produce_warn: False
when: ansible_version.full is version("2.14", "<")
tags:
- always

- name: "RedHat | Installing zabbix-agent"
ansible.builtin.package:
pkg:
Expand Down
3 changes: 1 addition & 2 deletions roles/zabbix_server/tasks/initialize-pgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
login_host: "{{ zabbix_server_dbhost }}"
port: "{{ zabbix_server_dbport }}"
db: "{{ zabbix_server_dbname }}"
query: 'SELECT mandatory FROM dbversion'
query: "SELECT mandatory FROM dbversion"
rescue:
- name: "PostgreSQL | Import schema"
community.postgresql.postgresql_db:
Expand All @@ -105,7 +105,6 @@
args:
creates: /etc/zabbix/timescaledb.done
executable: /bin/bash
warn: "{{ produce_warn | default(omit) }}"
environment:
PGPASSWORD: "{{ zabbix_server_dbpassword }}"
become: true
Expand Down

0 comments on commit f701aa0

Please sign in to comment.