Update conditonals and add required tasks to RedHat.yml

This commit is contained in:
Jose M 2019-11-21 18:45:01 +01:00
parent 7bf823bcad
commit 628dcb2ccc

View File

@ -1,7 +1,4 @@
--- ---
- include_tasks: "../tasks/installation_from_sources.yml"
when:
- wazuh_manager_sources_installation.enabled
- name: RedHat/CentOS | Install Nodejs repo - name: RedHat/CentOS | Install Nodejs repo
yum_repository: yum_repository:
@ -13,6 +10,7 @@
changed_when: false changed_when: false
when: when:
- ansible_distribution_major_version|int > 5 - ansible_distribution_major_version|int > 5
- not wazuh_api_sources_installation.enabled
- name: Fedora | Install Nodejs repo - name: Fedora | Install Nodejs repo
yum_repository: yum_repository:
@ -21,7 +19,9 @@
baseurl: https://rpm.nodesource.com/pub_6.x/fc/$releasever/x86_64 baseurl: https://rpm.nodesource.com/pub_6.x/fc/$releasever/x86_64
gpgkey: https://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL gpgkey: https://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL
gpgcheck: true gpgcheck: true
when: ansible_distribution == 'Fedora' when:
- ansible_distribution == 'Fedora'
- not wazuh_api_sources_installation.enabled
- name: AmazonLinux | Get Nodejs - name: AmazonLinux | Get Nodejs
shell: | shell: |
@ -33,6 +33,7 @@
creates: /etc/yum.repos.d/nodesource-el7.repo creates: /etc/yum.repos.d/nodesource-el7.repo
when: when:
- ansible_distribution|lower == "amazon" - ansible_distribution|lower == "amazon"
- not wazuh_api_sources_installation.enabled
- name: RedHat/CentOS 5 | Install Wazuh repo - name: RedHat/CentOS 5 | Install Wazuh repo
yum_repository: yum_repository:
@ -46,6 +47,7 @@
- (ansible_os_family|lower == 'redhat') and (ansible_distribution|lower != 'amazon') - (ansible_os_family|lower == 'redhat') and (ansible_distribution|lower != 'amazon')
- (ansible_distribution_major_version|int <= 5) - (ansible_distribution_major_version|int <= 5)
- not wazuh_manager_sources_installation.enabled - not wazuh_manager_sources_installation.enabled
- not wazuh_api_sources_installation.enabled
register: repo_v5_manager_installed register: repo_v5_manager_installed
- name: RedHat/CentOS/Fedora | Install Wazuh repo - name: RedHat/CentOS/Fedora | Install Wazuh repo
@ -58,7 +60,7 @@
changed_when: false changed_when: false
when: when:
- repo_v5_manager_installed is skipped - repo_v5_manager_installed is skipped
- not wazuh_manager_sources_installation.enabled - not wazuh_manager_sources_installation.enabled or not wazuh_api_sources_installation.enabled
- name: RedHat/CentOS/Fedora | Install openscap - name: RedHat/CentOS/Fedora | Install openscap
package: name={{ item }} state=present package: name={{ item }} state=present
@ -144,13 +146,10 @@
when: when:
- ansible_distribution == "Amazon" and ansible_distribution_major_version == "NA" - ansible_distribution == "Amazon" and ansible_distribution_major_version == "NA"
- name: CentOS/RedHat/Amazon | Install wazuh-manager, wazuh-api - name: CentOS/RedHat/Amazon | Install Wazuh Manager
package: package:
name: "{{ item }}-{{ wazuh_manager_version }}" name: "wazuh-manager-{{ wazuh_manager_version }}"
state: "{{ wazuh_manager_package_state }}" state: "{{ wazuh_manager_package_state }}"
with_items:
- wazuh-manager
- wazuh-api
register: wazuh_manager_main_packages_installed register: wazuh_manager_main_packages_installed
until: wazuh_manager_main_packages_installed is succeeded until: wazuh_manager_main_packages_installed is succeeded
when: when:
@ -159,6 +158,28 @@
tags: tags:
- init - init
- include_tasks: "../tasks/installation_from_sources.yml"
tags: manager
when:
- wazuh_manager_sources_installation.enabled
- name: CentOS/RedHat/Amazon | Install Wazuh API
package:
name: "wazuh-api-{{ wazuh_manager_version }}"
state: "{{ wazuh_manager_package_state }}"
register: wazuh_api_main_packages_installed
until: wazuh_api_main_packages_installed is succeeded
when:
- ansible_os_family|lower == "redhat"
- not wazuh_api_sources_installation.enabled
tags:
- init
- include_tasks: "../tasks/installation_from_sources.yml"
tags: api
when:
- wazuh_api_sources_installation.enabled
- name: CentOS/RedHat 6 | Enabling python2.7 and sqlite3 - name: CentOS/RedHat 6 | Enabling python2.7 and sqlite3
replace: replace:
path: /etc/init.d/wazuh-manager path: /etc/init.d/wazuh-manager
@ -181,3 +202,4 @@
- ansible_distribution_major_version|int < 6 - ansible_distribution_major_version|int < 6
tags: tags:
- init - init