From 4061a06e9e245fe87e7b06eeb5690becb352f31b Mon Sep 17 00:00:00 2001 From: "Troy W." Date: Wed, 19 Jun 2024 13:54:01 -0400 Subject: [PATCH] Fixed PSK Logic --- changelogs/fragments/1297.yml | 2 ++ roles/zabbix_agent/tasks/main.yml | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 changelogs/fragments/1297.yml diff --git a/changelogs/fragments/1297.yml b/changelogs/fragments/1297.yml new file mode 100644 index 000000000..ac254da6c --- /dev/null +++ b/changelogs/fragments/1297.yml @@ -0,0 +1,2 @@ +bugfixes: + - Agent Role - Fixed logic problem that would break if anything other than PSK was used. diff --git a/roles/zabbix_agent/tasks/main.yml b/roles/zabbix_agent/tasks/main.yml index 726cd0e04..7c6be4f53 100644 --- a/roles/zabbix_agent/tasks/main.yml +++ b/roles/zabbix_agent/tasks/main.yml @@ -52,12 +52,6 @@ when: - not (zabbix_agent_docker | bool) -- name: Gather PSK Secret Info - ansible.builtin.include_tasks: psk_secret.yml - -- name: Gather PSK Identity Info - ansible.builtin.include_tasks: psk_identity.yml - - name: AutoPSK | Default tlsaccept and tlsconnect to enforce PSK ansible.builtin.set_fact: zabbix_agent_tlsaccept: psk @@ -66,6 +60,22 @@ tags: - config +- name: Configure PSK + when: "zabbix_agent_tlsaccept == 'psk' or zabbix_agent_tlsconnect == 'psk'" + block: + - name: Gather PSK Secret Info + ansible.builtin.include_tasks: psk_secret.yml + + - name: Gather PSK Identity Info + ansible.builtin.include_tasks: psk_identity.yml + + - name: "Configure Agent" + ansible.builtin.include_tasks: Windows_conf.yml + when: + - ansible_os_family == "Windows" + tags: + - config + - name: "Configure Agent" ansible.builtin.include_tasks: Windows_conf.yml when: