Update installation_from_sources.yml. Added installation conditionals

This commit is contained in:
Jose M 2019-11-15 16:42:27 +01:00
parent 46b4d34695
commit 8ecbeff501

View File

@ -7,53 +7,59 @@
name:
- make
- gcc
- policycoreutils-python-utils
- automake
- autoconf
- libtool
state: present
- 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: Download required packages from github.com/wazuh/wazuh
get_url:
url: "https://github.com/wazuh/wazuh/archive/{{ wazuh_agent_config.repo.sources_branch }}.tar.gz"
dest: "/tmp/{{ wazuh_agent_config.repo.sources_branch }}.tar.gz"
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_agent_config.repo.sources_branch }}.tar.gz"
src: "/tmp/{{ wazuh_sources_installation.branch }}.tar.gz"
dest: "/tmp/"
remote_src: yes
- name: Configure "preloaded_vars.conf" file
copy:
dest: "/tmp/wazuh-{{ wazuh_agent_config.repo.sources_branch }}/etc/preloaded-vars.conf"
content: |
USER_LANGUAGE="en"
USER_NO_STOP="y"
USER_INSTALL_TYPE="agent"
USER_DIR="/var/ossec"
USER_ENABLE_SYSCHECK="y"
USER_ENABLE_ROOTCHECK="y"
USER_ENABLE_OPENSCAP="y"
USER_ENABLE_ACTIVE_RESPONSE="y"
USER_AGENT_SERVER_IP="{{ wazuh_managers.0.address }}"
USER_CA_STORE="/var/ossec/wpk_root.pem"
USER_ENABLE_SCA="y"
force: yes
- name: Clean remaining files from others builds
command: "make -C src {{ item }}"
args:
chdir: "/tmp/wazuh-{{ wazuh_agent_config.repo.sources_branch }}/src/"
chdir: "/tmp/wazuh-{{ wazuh_sources_installation.branch }}/src/"
with_items:
- "clean"
- "clean-deps"
failed_when: false
failed_when: 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: Executing "install.sh" script to build and install the Wazuh Agent
shell: ./install.sh
args:
chdir: "/tmp/wazuh-{{ wazuh_agent_config.repo.sources_branch }}"
chdir: "/tmp/wazuh-{{ wazuh_sources_installation.branch }}"
become: yes