From 8e56076b9fc8e4200a4dadd5dfbf67943844ec5f Mon Sep 17 00:00:00 2001 From: Jose M Date: Thu, 14 Nov 2019 19:11:59 +0100 Subject: [PATCH] Add conditionals to disable repo installation and install from sources --- roles/wazuh/ansible-wazuh-agent/tasks/Debian.yml | 7 +++++++ roles/wazuh/ansible-wazuh-agent/tasks/RedHat.yml | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/roles/wazuh/ansible-wazuh-agent/tasks/Debian.yml b/roles/wazuh/ansible-wazuh-agent/tasks/Debian.yml index 1aa7a38e..cd7f3d77 100644 --- a/roles/wazuh/ansible-wazuh-agent/tasks/Debian.yml +++ b/roles/wazuh/ansible-wazuh-agent/tasks/Debian.yml @@ -1,4 +1,9 @@ --- + +- include_tasks: "installation_from_sources" + when: + - wazuh_agent_config.repo.sources == "true" + - name: Debian/Ubuntu | Install apt-transport-https and ca-certificates apt: name: @@ -33,6 +38,8 @@ repo: "{{ wazuh_agent_config.repo.apt }}" state: present update_cache: true + when: + - wazuh_agent_config.repo.sources == "false" - name: Debian/Ubuntu | Set Distribution CIS filename for debian set_fact: diff --git a/roles/wazuh/ansible-wazuh-agent/tasks/RedHat.yml b/roles/wazuh/ansible-wazuh-agent/tasks/RedHat.yml index 8f3b8dbd..1aa909fa 100644 --- a/roles/wazuh/ansible-wazuh-agent/tasks/RedHat.yml +++ b/roles/wazuh/ansible-wazuh-agent/tasks/RedHat.yml @@ -1,4 +1,9 @@ --- + +- include_tasks: "installation_from_sources" + when: + - wazuh_agent_config.repo.sources == "true" + - name: RedHat/CentOS 5 | Install Wazuh repo yum_repository: name: wazuh_repo @@ -10,6 +15,7 @@ when: - (ansible_facts['os_family']|lower == 'redhat') and (ansible_distribution|lower != 'amazon') - (ansible_distribution_major_version|int <= 5) + - wazuh_agent_config.repo.sources == "false" register: repo_v5_installed - name: RedHat/CentOS/Fedora | Install Wazuh repo @@ -22,6 +28,7 @@ changed_when: false when: - repo_v5_installed is skipped + - wazuh_agent_config.repo.sources == "false" - name: RedHat/CentOS/Fedora | download Oracle Java RPM get_url: