diff --git a/.github/workflows/agent.yml b/.github/workflows/agent.yml index 2e0660b67..29810bacd 100644 --- a/.github/workflows/agent.yml +++ b/.github/workflows/agent.yml @@ -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: | diff --git a/.github/workflows/javagateway.yml b/.github/workflows/javagateway.yml index f7a8b2fae..f3c261703 100644 --- a/.github/workflows/javagateway.yml +++ b/.github/workflows/javagateway.yml @@ -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: | diff --git a/.github/workflows/plugins-integration.yml b/.github/workflows/plugins-integration.yml index 644ba2ca3..ca50cae9b 100644 --- a/.github/workflows/plugins-integration.yml +++ b/.github/workflows/plugins-integration.yml @@ -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 diff --git a/.github/workflows/proxy.yml b/.github/workflows/proxy.yml index f165ef204..64cf5db86 100644 --- a/.github/workflows/proxy.yml +++ b/.github/workflows/proxy.yml @@ -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: | diff --git a/.github/workflows/repo-sanity.yml b/.github/workflows/repo-sanity.yml index ba776e54f..fa96a1885 100644 --- a/.github/workflows/repo-sanity.yml +++ b/.github/workflows/repo-sanity.yml @@ -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 @@ -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 }} diff --git a/.github/workflows/server.yml b/.github/workflows/server.yml index dd8264507..da651e41b 100644 --- a/.github/workflows/server.yml +++ b/.github/workflows/server.yml @@ -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: | diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 243d2da6d..5ceb8b746 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -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: | diff --git a/README.md b/README.md index 6663beb2d..296c7195d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/changelogs/fragments/1237.yml b/changelogs/fragments/1237.yml new file mode 100644 index 000000000..fb65bb289 --- /dev/null +++ b/changelogs/fragments/1237.yml @@ -0,0 +1,2 @@ +bugfixes: + - Agent Role - Fixed missing setting for `zabbix_agent_persistentbuffer` diff --git a/changelogs/fragments/pr_1259.yml b/changelogs/fragments/pr_1259.yml new file mode 100644 index 000000000..944833c1c --- /dev/null +++ b/changelogs/fragments/pr_1259.yml @@ -0,0 +1,7 @@ +minor_changes: + - zabbix_agent - added 10 retries to agent API calls to workaround connection problems on macOS +bugfixes: + - zabbix_agent - in ``zabbix_agent_interfaces`` directly use ``zabbix_agent_listenport``, which does already contains + the agent2 value if needed + - zabbix_agent - fix error when ``zabbix_agent_tlsaccept`` is not set + - zabbix_agent - fix error when ``zabbix_agent_tlsconnect`` is not set diff --git a/changelogs/fragments/pr_1269.yml b/changelogs/fragments/pr_1269.yml new file mode 100644 index 000000000..778cc98a6 --- /dev/null +++ b/changelogs/fragments/pr_1269.yml @@ -0,0 +1,2 @@ +bugfixes: + - remove references to tags in LLD rules diff --git a/changelogs/fragments/remove_old_ansible.yml b/changelogs/fragments/remove_old_ansible.yml new file mode 100644 index 000000000..b35315ab6 --- /dev/null +++ b/changelogs/fragments/remove_old_ansible.yml @@ -0,0 +1,2 @@ +breaking_changes: + - Remove support for Ansible < 2.15 and Python < 3.9 diff --git a/molecule/zabbix_javagateway/prepare.yml b/molecule/zabbix_javagateway/prepare.yml index 7949591d8..f4a4098c9 100644 --- a/molecule/zabbix_javagateway/prepare.yml +++ b/molecule/zabbix_javagateway/prepare.yml @@ -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: diff --git a/molecule/zabbix_proxy/prepare.yml b/molecule/zabbix_proxy/prepare.yml index 1f03f59b8..fd6fde987 100644 --- a/molecule/zabbix_proxy/prepare.yml +++ b/molecule/zabbix_proxy/prepare.yml @@ -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: diff --git a/molecule/zabbix_server/prepare.yml b/molecule/zabbix_server/prepare.yml index 725e6d718..2ef218f7c 100644 --- a/molecule/zabbix_server/prepare.yml +++ b/molecule/zabbix_server/prepare.yml @@ -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: diff --git a/molecule/zabbix_web/prepare.yml b/molecule/zabbix_web/prepare.yml index 7d8142763..25bfc598b 100644 --- a/molecule/zabbix_web/prepare.yml +++ b/molecule/zabbix_web/prepare.yml @@ -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: diff --git a/plugins/modules/zabbix_discoveryrule.py b/plugins/modules/zabbix_discoveryrule.py index 725fd43e3..ed567c091 100644 --- a/plugins/modules/zabbix_discoveryrule.py +++ b/plugins/modules/zabbix_discoveryrule.py @@ -10,7 +10,7 @@ DOCUMENTATION = r''' --- module: zabbix_discoveryrule -short_description: Create/delete Zabbix discovery rules +short_description: Create/delete Zabbix low-level discovery (LLD) rules description: - Create discoveryrules if they do not exist. - Delete existing discoveryrules if they exist. @@ -206,7 +206,7 @@ enabled: True state: present -# Add tags to the existing Zabbix LLD rule +# Change interval for existing Zabbix LLD rule - name: update rule # set task level variables as we change ansible_connection plugin here vars: @@ -221,13 +221,7 @@ name: mounted_filesystem_discovery template_name: example_template params: - type: zabbix_agent - key: 'vfs.fs.discovery' - interval: 1h - enabled: True - tags: - - tag: class - value: application + interval: 2h state: present # Delete LLD rule diff --git a/roles/zabbix_agent/defaults/main.yml b/roles/zabbix_agent/defaults/main.yml index 83f002808..15059ed33 100644 --- a/roles/zabbix_agent/defaults/main.yml +++ b/roles/zabbix_agent/defaults/main.yml @@ -58,7 +58,7 @@ zabbix_agent_interfaces: useip: "{{ zabbix_useuip }}" ip: "{{ zabbix_agent_ip }}" dns: "{{ ansible_fqdn }}" - port: "{{ (zabbix_agent2 == True) | ternary(zabbix_agent2_listenport, zabbix_agent_listenport) }}" + port: "{{ zabbix_agent_listenport }}" # Zabbix configuration variables zabbix_agent_listeninterface: diff --git a/roles/zabbix_agent/tasks/RedHat.yml b/roles/zabbix_agent/tasks/RedHat.yml index 1d519bd49..48ee3a2c2 100644 --- a/roles/zabbix_agent/tasks/RedHat.yml +++ b/roles/zabbix_agent/tasks/RedHat.yml @@ -1,13 +1,6 @@ --- # Tasks specific for RedHat systems -- 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: diff --git a/roles/zabbix_agent/tasks/api.yml b/roles/zabbix_agent/tasks/api.yml index 0013f1783..775c7e89c 100644 --- a/roles/zabbix_agent/tasks/api.yml +++ b/roles/zabbix_agent/tasks/api.yml @@ -7,6 +7,7 @@ - zabbix_api_create_hostgroup | bool register: zabbix_api_hostgroup_created until: zabbix_api_hostgroup_created is succeeded + retries: 10 delegate_to: "{{ zabbix_api_server_host }}" tags: - api @@ -27,8 +28,8 @@ tls_psk_identity: "{{ zabbix_agent_tlspskidentity | default(omit) }}" tls_issuer: "{{ zabbix_agent_tlsservercertissuer | default(omit) }}" tls_subject: "{{ zabbix_agent_tls_subject | default(omit) }}" - tls_accept: "{{ zabbix_agent_tls_config[zabbix_agent_tlsaccept if zabbix_agent_tlsaccept else 'unencrypted'] }}" - tls_connect: "{{ zabbix_agent_tls_config[zabbix_agent_tlsconnect if zabbix_agent_tlsconnect else 'unencrypted'] }}" + tls_accept: "{{ zabbix_agent_tls_config[zabbix_agent_tlsaccept | default('unencrypted')] }}" + tls_connect: "{{ zabbix_agent_tls_config[zabbix_agent_tlsconnect | default('unencrypted')] }}" description: "{{ zabbix_agent_description | default(omit) }}" inventory_zabbix: "{{ zabbix_agent_inventory_zabbix | default({}) }}" ipmi_authtype: "{{ zabbix_agent_ipmi_authtype | default(omit) }}" @@ -38,6 +39,7 @@ tags: "{{ zabbix_agent_tags | default(omit) }}" register: zabbix_api_host_created until: zabbix_api_host_created is succeeded + retries: 10 delegate_to: "{{ zabbix_api_server_host }}" changed_when: false tags: @@ -54,6 +56,7 @@ - item.macro_key is defined register: zabbix_api_hostmarcro_created until: zabbix_api_hostmarcro_created is succeeded + retries: 10 delegate_to: "{{ zabbix_api_server_host }}" tags: - api diff --git a/roles/zabbix_agent/tasks/main.yml b/roles/zabbix_agent/tasks/main.yml index cf00ccb28..1d1316460 100644 --- a/roles/zabbix_agent/tasks/main.yml +++ b/roles/zabbix_agent/tasks/main.yml @@ -46,6 +46,7 @@ zabbix_agent_listenport: "{{ zabbix_agent_listenport is defined | ternary(zabbix_agent_listenport, zabbix_agent2_listenport) | default(10050) }}" zabbix_agent_logfilesize: "{{ zabbix_agent_logfilesize is defined | ternary(zabbix_agent_logfilesize, zabbix_agent2_logfilesize) | default(100) }}" zabbix_agent_logtype: "{{ zabbix_agent_logtype is defined | ternary(zabbix_agent_logtype, zabbix_agent2_logtype) | default('file') }}" + zabbix_agent_persistentbuffer: "{{ zabbix_agent_persistentbuffer is defined | ternary(zabbix_agent_persistentbuffer, zabbix_agent_persistentbuffer) | default(0) }}" zabbix_agent_persistentbufferperiod: "{{ zabbix_agent_persistentbufferperiod is defined | ternary(zabbix_agent_persistentbufferperiod, zabbix_agent2_persistentbufferperiod) | default('1h') }}" zabbix_agent_refreshactivechecks: "{{ zabbix_agent_refreshactivechecks is defined | ternary(zabbix_agent_refreshactivechecks, zabbix_agent2_refreshactivechecks) | default(120) }}" zabbix_agent_statusport: "{{ zabbix_agent_statusport is defined | ternary(zabbix_agent_statusport, zabbix_agent2_statusport) | default(9999) }}" diff --git a/roles/zabbix_agent/templates/agent.conf.j2 b/roles/zabbix_agent/templates/agent.conf.j2 index 7cf1d97e4..ddce677ae 100644 --- a/roles/zabbix_agent/templates/agent.conf.j2 +++ b/roles/zabbix_agent/templates/agent.conf.j2 @@ -48,6 +48,7 @@ DenyKey={{ item }} {% else %} # DenyKey= {% endif %} +{{ (zabbix_agent_enablepersistentbuffer is defined and zabbix_agent_enablepersistentbuffer is not none) | ternary('', '# ') }}EnablePersistentBuffer={{ zabbix_agent_enablepersistentbuffer | default('') }} {% if not zabbix_agent2 %} {{ (zabbix_agent_enableremotecommands is defined and zabbix_agent_enableremotecommands is not none) | ternary('', '# ') }}EnableRemoteCommands={{ zabbix_agent_enableremotecommands | default('') }} {% endif %} diff --git a/roles/zabbix_server/tasks/initialize-pgsql.yml b/roles/zabbix_server/tasks/initialize-pgsql.yml index 6f40c66f2..3cd807812 100644 --- a/roles/zabbix_server/tasks/initialize-pgsql.yml +++ b/roles/zabbix_server/tasks/initialize-pgsql.yml @@ -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: @@ -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 diff --git a/tests/integration/targets/test_zabbix_discoveryrule/tasks/zabbix_tests.yml b/tests/integration/targets/test_zabbix_discoveryrule/tasks/zabbix_tests.yml index ffed13e05..e0fbe9d8c 100644 --- a/tests/integration/targets/test_zabbix_discoveryrule/tasks/zabbix_tests.yml +++ b/tests/integration/targets/test_zabbix_discoveryrule/tasks/zabbix_tests.yml @@ -9,9 +9,6 @@ key: 'vfs.fs.discovery' interval: 1m enabled: True - tags: - - tag: tag - value: value state: present register: zbxhostrule_new @@ -28,9 +25,6 @@ key: 'vfs.fs.discovery' interval: 1m enabled: True - tags: - - tag: tag - value: value state: present register: zbxhostrule_existing @@ -82,9 +76,6 @@ key: 'vfs.fs.discovery' interval: 1m enabled: True - tags: - - tag: tag - value: value state: present register: zbxtemprule_new @@ -101,9 +92,6 @@ key: 'vfs.fs.discovery' interval: 1m enabled: True - tags: - - tag: tag - value: value state: present register: zbxtemprule_existing