diff --git a/roles/wazuh/ansible-wazuh-agent/tasks/installation_from_sources.yml b/roles/wazuh/ansible-wazuh-agent/tasks/installation_from_sources.yml index afc3605f..70c3b5af 100644 --- a/roles/wazuh/ansible-wazuh-agent/tasks/installation_from_sources.yml +++ b/roles/wazuh/ansible-wazuh-agent/tasks/installation_from_sources.yml @@ -9,6 +9,14 @@ - libtool - tar state: present + + - name: Removing old files + file: "/tmp/{{ wazuh_agent_sources_installation.branch }}.tar.gz" + state: absent + + - name: Removing old folders + file: "/tmp/wazuh-{{ wazuh_agent_sources_installation.branch }}" + state: absent - name: Installing policycoreutils-python (RedHat families) package: @@ -75,4 +83,12 @@ register: installation_result changed_when: installation_result == 0 args: - chdir: "/tmp/wazuh-{{ wazuh_agent_sources_installation.branch }}" \ No newline at end of file + chdir: "/tmp/wazuh-{{ wazuh_agent_sources_installation.branch }}" + + - name: Cleanup downloaded files + file: "/tmp/{{ wazuh_agent_sources_installation.branch }}.tar.gz" + state: absent + + - name: Cleanup created folders + file: "/tmp/wazuh-{{ wazuh_agent_sources_installation.branch }}" + state: absent \ No newline at end of file diff --git a/roles/wazuh/ansible-wazuh-manager/tasks/installation_from_sources.yml b/roles/wazuh/ansible-wazuh-manager/tasks/installation_from_sources.yml index a0d22133..69d27cfd 100644 --- a/roles/wazuh/ansible-wazuh-manager/tasks/installation_from_sources.yml +++ b/roles/wazuh/ansible-wazuh-manager/tasks/installation_from_sources.yml @@ -18,6 +18,14 @@ - tar state: present + - name: Removing old files + file: "/tmp/{{ wazuh_manager_sources_installation.branch }}.tar.gz" + state: absent + + - name: Removing old folders + file: "/tmp/wazuh-{{ wazuh_manager_sources_installation.branch }}" + state: absent + - name: Installing policycoreutils-python (RedHat families) package: name: @@ -88,6 +96,15 @@ changed_when: installation_result == 0 args: chdir: "/tmp/wazuh-{{ wazuh_manager_sources_installation.branch }}" + + - name: Cleanup downloaded files + file: "/tmp/{{ wazuh_manager_sources_installation.branch }}.tar.gz" + state: absent + + - name: Cleanup created folders + file: "/tmp/wazuh-{{ wazuh_manager_sources_installation.branch }}" + state: absent + when: - not wazuh_ossec_control.stat.exists - wazuh_manager_sources_installation.enabled @@ -95,6 +112,7 @@ - manager # Wazuh API + - name: Check if Wazuh API is already installed stat: path: /var/ossec/api/app.js @@ -118,33 +136,6 @@ name: git state: present - - name: Modify repo url if host is in Debian family - set_fact: - node_js_repo_type: deb - when: - - ansible_os_family | lower == "debian" - - - name: Download script to install Nodejs repository - get_url: - url: "https://{{ node_js_repo_type }}.{{ node_js_repo_url }}" - dest: "/tmp/setup_nodejs_repo.sh" - mode: "0700" - - - name: Execute downloaded script to install Nodejs repo - command: /tmp/setup_nodejs_repo.sh - register: node_repo_installation_result - changed_when: node_repo_installation_result.rc == 0 - - - name: Install Nodejs - package: - name: nodejs - state: present - - - name: Run NPM under root account - command: npm config set user 0 - register: allow_root_npm - changed_when: allow_root_npm.rc == 0 - - name: Remove old repository folder file: path: /tmp/wazuh-api @@ -176,4 +167,6 @@ - not wazuh_api.stat.exists - wazuh_api_sources_installation.enabled tags: - - api \ No newline at end of file + - api + + \ No newline at end of file