Merge pull request #288 from wazuh/feature-287-avoid-repo-hardcoding

Avoid repository hardcoding
This commit is contained in:
Manuel J. Bernal 2019-10-29 17:20:06 +01:00 committed by GitHub
commit b964d15607
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 49 additions and 38 deletions

6
CHANGELOG.md Normal file → Executable file
View File

@ -1,6 +1,12 @@
# Change Log
All notable changes to this project will be documented in this file.
## [v3.xx.x_x.x.x]
## Changed
- Make Wazuh repositories installation flexible [@jm404](https://github.com/jm404) [#288](https://github.com/wazuh/wazuh-ansible/pull/288)
## [v3.10.2_7.3.2]
### Added

View File

@ -31,6 +31,10 @@ wazuh_winagent_config:
repo: https://packages.wazuh.com/3.x/windows/
md5: 71650780904cbfc2e45eae4298adb7a3
wazuh_agent_config:
repo:
apt: 'https://packages.wazuh.com/3.x/apt/ stable main'
yum: 'https://packages.wazuh.com/3.x/yum/'
gpg: 'https://packages.wazuh.com/key/GPG-KEY-WAZUH'
active_response:
ar_disabled: 'no'
ca_store: '/var/ossec/etc/wpk_root.pem'

View File

@ -22,13 +22,14 @@
- ansible_distribution_major_version | int == 14
- name: Debian/Ubuntu | Installing Wazuh repository key
apt_key: url=https://packages.wazuh.com/key/GPG-KEY-WAZUH
apt_key:
url: "{{ wazuh_agent_config.repo.gpg }}"
when:
- not (ansible_distribution == "Ubuntu" and ansible_distribution_major_version | int == 14)
- name: Debian/Ubuntu | Add Wazuh repositories
apt_repository:
repo: 'deb https://packages.wazuh.com/3.x/apt/ stable main'
repo: "deb {{ wazuh_agent_config.repo.apt }}"
state: present
update_cache: true

View File

@ -1,36 +1,27 @@
---
- name: RedHat/CentOS/Fedora | Install Wazuh repo
yum_repository:
name: wazuh_repo
description: Wazuh repository
baseurl: https://packages.wazuh.com/3.x/yum/
gpgkey: https://packages.wazuh.com/key/GPG-KEY-WAZUH
gpgcheck: true
changed_when: false
when:
- ansible_distribution_major_version|int > 5
- name: RedHat/CentOS 5 | Install Wazuh repo
yum_repository:
name: wazuh_repo
description: Wazuh repository
baseurl: https://packages.wazuh.com/3.x/yum/5/
gpgkey: https://packages.wazuh.com/key/GPG-KEY-WAZUH-5
baseurl: "{{ wazuh_agent_config.repo.yum }}5/"
gpgkey: "{{ wazuh_agent_config.repo.gpg }}-5"
gpgcheck: true
changed_when: false
when:
- ansible_distribution_major_version|int == 5
- (ansible_facts['os_family']|lower == 'redhat')
- (ansible_distribution_major_version|int <= 5)
register: repo_v5_installed
- name: AmazonLinux | Install Wazuh repo
- name: RedHat/CentOS/Fedora | Install Wazuh repo
yum_repository:
name: wazuh_repo
description: Wazuh repository
baseurl: https://packages.wazuh.com/3.x/yum/
gpgkey: https://packages.wazuh.com/key/GPG-KEY-WAZUH
baseurl: "{{ wazuh_agent_config.repo.yum }}"
gpgkey: "{{ wazuh_agent_config.repo.gpg }}"
gpgcheck: true
changed_when: false
when:
- ansible_distribution == "Amazon" and ansible_distribution_major_version == "NA"
- repo_v5_installed.skipped
- name: RedHat/CentOS/Fedora | download Oracle Java RPM
get_url:

View File

@ -5,6 +5,10 @@ wazuh_manager_fqdn: "wazuh-server"
wazuh_manager_package_state: latest
wazuh_manager_config:
repo:
apt: 'https://packages.wazuh.com/3.x/apt/ stable main'
yum: 'https://packages.wazuh.com/3.x/yum/'
gpg: 'https://packages.wazuh.com/key/GPG-KEY-WAZUH'
json_output: 'yes'
alerts_log: 'yes'
logall: 'no'

View File

@ -24,13 +24,14 @@
- ansible_distribution_major_version | int == 14
- name: Debian/Ubuntu | Installing Wazuh repository key
apt_key: url=https://packages.wazuh.com/key/GPG-KEY-WAZUH
apt_key:
url: "{{ wazuh_manager_config.repo.gpg }}"
when:
- not (ansible_distribution == "Ubuntu" and ansible_distribution_major_version | int == 14)
- name: Debian/Ubuntu | Add Wazuh repositories
apt_repository:
repo: 'deb https://packages.wazuh.com/3.x/apt/ stable main'
repo: "deb {{ wazuh_manager_config.repo.apt }}"
state: present
update_cache: true
changed_when: false
@ -49,7 +50,8 @@
- ansible_distribution_major_version | int == 14
- name: Debian/Ubuntu | Installing NodeJS repository key
apt_key: url=https://deb.nodesource.com/gpgkey/nodesource.gpg.key
apt_key:
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
when:
- not (ansible_distribution == "Ubuntu" and ansible_distribution_major_version | int == 14)

View File

@ -38,26 +38,29 @@
when:
- ansible_distribution == "Amazon" and ansible_distribution_major_version == "NA"
- name: RedHat/CentOS/Fedora | Install Wazuh repo
yum_repository:
name: wazuh_repo
description: Wazuh repository
baseurl: https://packages.wazuh.com/3.x/yum/
gpgkey: https://packages.wazuh.com/key/GPG-KEY-WAZUH
gpgcheck: true
changed_when: false
when:
- (ansible_distribution_major_version|int > 5) or (ansible_distribution == "Amazon" and ansible_distribution_major_version == "NA")
- name: RedHat/CentOS 5 | Install Wazuh repo
yum_repository:
name: wazuh_repo
description: Wazuh repository
baseurl: https://packages.wazuh.com/3.x/yum/5/
gpgkey: https://packages.wazuh.com/key/GPG-KEY-WAZUH
baseurl: "{{ wazuh_manager_config.repo.yum }}5/"
gpgkey: "{{ wazuh_manager_config.repo.gpg }}-5"
gpgcheck: true
changed_when: false
when:
- ansible_distribution_major_version|int == 5
- (ansible_facts['os_family']|lower == 'redhat')
- (ansible_distribution_major_version|int <= 5)
register: repo_v5_manager_installed
- name: RedHat/CentOS/Fedora | Install Wazuh repo
yum_repository:
name: wazuh_repo
description: Wazuh repository
baseurl: "{{ wazuh_manager_config.repo.yum }}"
gpgkey: "{{ wazuh_manager_config.repo.gpg }}"
gpgcheck: true
changed_when: false
when:
- repo_v5_manager_installed.skipped
- name: RedHat/CentOS/Fedora | Install openscap
package: name={{ item }} state=present