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