Skip to content

Commit

Permalink
Fixed use of bare vars on agent2 tasks for linux (#663)
Browse files Browse the repository at this point in the history
- Added bool filter on zabbix_agent2 and zabbix_agent_package_remove vars
- Removed implicit conditionals on psk files vars when "is defined" should be enough
  • Loading branch information
danilomendes authored Apr 4, 2022
1 parent e3b5ff0 commit d8c9a35
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions roles/zabbix_agent/tasks/Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@
become: true
when:
- zabbix_agent_tlspskfile is defined
- zabbix_agent_tlspskfile
- not zabbix_agent2
- not (zabbix_agent2 | bool)

- name: "Create directory for PSK file if not exist (zabbix-agent2)"
file:
Expand All @@ -145,8 +144,7 @@
become: true
when:
- zabbix_agent2_tlspskfile is defined
- zabbix_agent2_tlspskfile
- zabbix_agent2
- zabbix_agent2 | bool

- name: "Place TLS PSK File"
copy:
Expand All @@ -158,9 +156,8 @@
become: true
when:
- zabbix_agent_tlspskfile is defined
- zabbix_agent_tlspskfile
- zabbix_agent_tlspsk_secret is defined
- not zabbix_agent2
- not (zabbix_agent2 | bool)
notify:
- restart zabbix-agent

Expand All @@ -174,9 +171,8 @@
become: true
when:
- zabbix_agent2_tlspskfile is defined
- zabbix_agent2_tlspskfile
- zabbix_agent2_tlspsk_secret is defined
- zabbix_agent2
- zabbix_agent2 | bool
notify:
- restart zabbix-agent

Expand Down Expand Up @@ -205,7 +201,7 @@
- name: "Remove zabbix-agent installation when zabbix-agent2 is used."
include: remove.yml
when:
- zabbix_agent2
- zabbix_agent2 | bool
- zabbix_agent_package_remove

- name: "Make sure the zabbix-agent service is running"
Expand Down

0 comments on commit d8c9a35

Please sign in to comment.