From 7d7e704bdd50f1b815a71b185c22f3c73f0535a5 Mon Sep 17 00:00:00 2001 From: emrocha <38505425+emrocha@users.noreply.github.com> Date: Sun, 15 Sep 2024 00:55:54 -0300 Subject: [PATCH] Set API tasks explicitly to become false (#1393) Undo some changes of commit 5480ff750bc9dd9133cce7156e229853923761e9 The community.zabbix.zabbix_host module with the delegate_to parameter should not be executed with "become true" if the role zabbix_agent is applied with "become true". It is possible that the user executing the ansible script has sudo permission on the remote computer that the zabbix_agent role will be executed on, but does not have sudo permission on the local computer from which the ansible script is initially executed. --- ...-fix-api-tasks-in-zabbix-agent-role-to-run-without-sudo.yml | 2 ++ roles/zabbix_agent/tasks/api.yml | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 changelogs/fragments/1393-fix-api-tasks-in-zabbix-agent-role-to-run-without-sudo.yml diff --git a/changelogs/fragments/1393-fix-api-tasks-in-zabbix-agent-role-to-run-without-sudo.yml b/changelogs/fragments/1393-fix-api-tasks-in-zabbix-agent-role-to-run-without-sudo.yml new file mode 100644 index 000000000..dab355b17 --- /dev/null +++ b/changelogs/fragments/1393-fix-api-tasks-in-zabbix-agent-role-to-run-without-sudo.yml @@ -0,0 +1,2 @@ +bugfixes: + - zabbix_agent Role - Set become parameter explicitly to false for API tasks to run without sudo on the local computer. diff --git a/roles/zabbix_agent/tasks/api.yml b/roles/zabbix_agent/tasks/api.yml index 543cda23a..c5dcc4a82 100644 --- a/roles/zabbix_agent/tasks/api.yml +++ b/roles/zabbix_agent/tasks/api.yml @@ -9,6 +9,7 @@ until: zabbix_api_hostgroup_created is succeeded retries: 10 delegate_to: "{{ zabbix_api_server_host }}" + become: false tags: - api @@ -43,6 +44,7 @@ until: zabbix_api_host_created is succeeded retries: 10 delegate_to: "{{ zabbix_api_server_host }}" + become: false changed_when: false tags: - api @@ -61,5 +63,6 @@ retries: 10 no_log: "{{ ansible_verbosity < 3 }}" delegate_to: "{{ zabbix_api_server_host }}" + become: false tags: - api