Skip to content

Commit

Permalink
Merge branch 'main' into 1262
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrodie18 authored Jun 5, 2024
2 parents bcfc22a + c919e2e commit 71d3737
Show file tree
Hide file tree
Showing 24 changed files with 58 additions and 84 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/1237.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- Agent Role - Fixed missing setting for `zabbix_agent_persistentbuffer`
7 changes: 7 additions & 0 deletions changelogs/fragments/pr_1259.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions changelogs/fragments/pr_1269.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- remove references to tags in LLD rules
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
12 changes: 3 additions & 9 deletions plugins/modules/zabbix_discoveryrule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion roles/zabbix_agent/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 0 additions & 7 deletions roles/zabbix_agent/tasks/RedHat.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
7 changes: 5 additions & 2 deletions roles/zabbix_agent/tasks/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) }}"
Expand All @@ -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:
Expand All @@ -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
1 change: 1 addition & 0 deletions roles/zabbix_agent/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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) }}"
Expand Down
1 change: 1 addition & 0 deletions roles/zabbix_agent/templates/agent.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
key: 'vfs.fs.discovery'
interval: 1m
enabled: True
tags:
- tag: tag
value: value
state: present
register: zbxhostrule_new

Expand All @@ -28,9 +25,6 @@
key: 'vfs.fs.discovery'
interval: 1m
enabled: True
tags:
- tag: tag
value: value
state: present
register: zbxhostrule_existing

Expand Down Expand Up @@ -82,9 +76,6 @@
key: 'vfs.fs.discovery'
interval: 1m
enabled: True
tags:
- tag: tag
value: value
state: present
register: zbxtemprule_new

Expand All @@ -101,9 +92,6 @@
key: 'vfs.fs.discovery'
interval: 1m
enabled: True
tags:
- tag: tag
value: value
state: present
register: zbxtemprule_existing

Expand Down

0 comments on commit 71d3737

Please sign in to comment.