Update tasks that download the Wazuh branch and extract it.

This commit is contained in:
Jose M 2019-11-20 14:59:38 +01:00
parent 219b35c2ef
commit 35d35b5059

View File

@ -1,68 +1,69 @@
---
- hosts: all
tasks:
- include_vars: ../defaults/main.yml
- name: Install dependencies to build Wazuh packages
package:
name:
- make
- gcc
- automake
- autoconf
- libtool
state: present
- name: Install dependencies to build Wazuh packages
package:
name:
- make
- gcc
- automake
- autoconf
- libtool
- tar
state: present
- name: Installing policycoreutils-python (RedHat families)
package:
name:
- policycoreutils-python
when:
- ansible_os_family|lower == "redhat"
- name: Installing policycoreutils-python (RedHat families)
package:
name:
- policycoreutils-python
when:
- ansible_os_family|lower == "redhat"
- name: Installing policycoreutils-python-utils (Debian families)
package:
name:
- libc6-dev
- curl
- policycoreutils
when:
- ansible_os_family|lower == "debian"
- name: Installing policycoreutils-python-utils (Debian families)
package:
name:
- libc6-dev
- curl
- policycoreutils
when:
- ansible_os_family|lower == "debian"
- name: Download required packages from github.com/wazuh/wazuh
get_url:
url: "https://github.com/wazuh/wazuh/archive/{{ wazuh_sources_installation.branch }}.tar.gz"
dest: "/tmp/{{ wazuh_sources_installation.branch }}.tar.gz"
delegate_to: "{{ inventory_hostname }}"
- name: Download required packages from github.com/wazuh/wazuh
get_url:
url: "https://github.com/wazuh/wazuh/archive/{{ wazuh_sources_installation.branch }}.tar.gz"
dest: "/tmp/{{ wazuh_sources_installation.branch }}.tar.gz"
delegate_to: "{{ inventory_hostname }}"
- name: Extract downloaded Wazuh branch from Github
unarchive:
src: "/tmp/{{ wazuh_sources_installation.branch }}.tar.gz"
dest: "/tmp/"
remote_src: yes
- name: Create folder to extract Wazuh branch
file:
path: "/tmp/wazuh-{{ wazuh_sources_installation.branch }}"
state: directory
- name: Clean remaining files from others builds
command: "make -C src {{ item }}"
args:
chdir: "/tmp/wazuh-{{ wazuh_sources_installation.branch }}/src/"
with_items:
- "clean"
- "clean-deps"
register: clean_result
changed_when: clean_result.rc == 0
failed_when: false
- name: Extract downloaded Wazuh branch from Github
shell: "tar -xzvf /tmp/{{ wazuh_sources_installation.branch }}.tar.gz --strip 1 --directory /tmp/wazuh-{{ wazuh_sources_installation.branch }}"
args:
warn: false
- name: Render the "preloaded-vars.conf" file
template:
src: /templates/preloaded_vars.conf.j2
dest: "/tmp/wazuh-{{ wazuh_sources_installation.branch }}/etc/preloaded-vars.conf"
owner: root
group: root
mode: '644'
- name: Clean remaining files from others builds
command: "make -C src {{ item }}"
args:
chdir: "/tmp/wazuh-{{ wazuh_sources_installation.branch }}/src/"
with_items:
- "clean"
- "clean-deps"
register: clean_result
changed_when: clean_result.rc == 0
failed_when: false
- name: Executing "install.sh" script to build and install the Wazuh Manager
shell: ./install.sh > /tmp/build_log.txt
register: installation_result
changed_when: installation_result == 0
args:
chdir: "/tmp/wazuh-{{ wazuh_sources_installation.branch }}"
become: yes
- name: Render the "preloaded-vars.conf" file
template:
src: "templates/preloaded_vars.conf.j2"
dest: "/tmp/wazuh-{{ wazuh_sources_installation.branch }}/etc/preloaded-vars.conf"
owner: root
group: root
mode: '644'
- name: Executing "install.sh" script to build and install the Wazuh Manager
shell: ./install.sh > /tmp/build_log.txt
register: installation_result
changed_when: installation_result == 0
args:
chdir: "/tmp/wazuh-{{ wazuh_sources_installation.branch }}"