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 # Change Log
All notable changes to this project will be documented in this file. 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] ## [v3.10.2_7.3.2]
### Added ### Added

View File

@ -31,6 +31,10 @@ wazuh_winagent_config:
repo: https://packages.wazuh.com/3.x/windows/ repo: https://packages.wazuh.com/3.x/windows/
md5: 71650780904cbfc2e45eae4298adb7a3 md5: 71650780904cbfc2e45eae4298adb7a3
wazuh_agent_config: 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: active_response:
ar_disabled: 'no' ar_disabled: 'no'
ca_store: '/var/ossec/etc/wpk_root.pem' ca_store: '/var/ossec/etc/wpk_root.pem'

View File

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

View File

@ -1,37 +1,28 @@
--- ---
- 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 - name: RedHat/CentOS 5 | Install Wazuh repo
yum_repository: yum_repository:
name: wazuh_repo name: wazuh_repo
description: Wazuh repository description: Wazuh repository
baseurl: https://packages.wazuh.com/3.x/yum/5/ baseurl: "{{ wazuh_agent_config.repo.yum }}5/"
gpgkey: https://packages.wazuh.com/key/GPG-KEY-WAZUH-5 gpgkey: "{{ wazuh_agent_config.repo.gpg }}-5"
gpgcheck: true gpgcheck: true
changed_when: false changed_when: false
when: 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: yum_repository:
name: wazuh_repo name: wazuh_repo
description: Wazuh repository description: Wazuh repository
baseurl: https://packages.wazuh.com/3.x/yum/ baseurl: "{{ wazuh_agent_config.repo.yum }}"
gpgkey: https://packages.wazuh.com/key/GPG-KEY-WAZUH gpgkey: "{{ wazuh_agent_config.repo.gpg }}"
gpgcheck: true gpgcheck: true
changed_when: false changed_when: false
when: when:
- ansible_distribution == "Amazon" and ansible_distribution_major_version == "NA" - repo_v5_installed.skipped
- name: RedHat/CentOS/Fedora | download Oracle Java RPM - name: RedHat/CentOS/Fedora | download Oracle Java RPM
get_url: get_url:
url: https://download.oracle.com/otn-pub/java/jdk/8u202-b08/1961070e4c9b4e26a04e7f5a083f551e/jre-8u202-linux-x64.rpm url: https://download.oracle.com/otn-pub/java/jdk/8u202-b08/1961070e4c9b4e26a04e7f5a083f551e/jre-8u202-linux-x64.rpm

View File

@ -5,6 +5,10 @@ wazuh_manager_fqdn: "wazuh-server"
wazuh_manager_package_state: latest wazuh_manager_package_state: latest
wazuh_manager_config: 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' json_output: 'yes'
alerts_log: 'yes' alerts_log: 'yes'
logall: 'no' logall: 'no'

View File

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

View File

@ -38,26 +38,29 @@
when: when:
- ansible_distribution == "Amazon" and ansible_distribution_major_version == "NA" - 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 - name: RedHat/CentOS 5 | Install Wazuh repo
yum_repository: yum_repository:
name: wazuh_repo name: wazuh_repo
description: Wazuh repository description: Wazuh repository
baseurl: https://packages.wazuh.com/3.x/yum/5/ baseurl: "{{ wazuh_manager_config.repo.yum }}5/"
gpgkey: https://packages.wazuh.com/key/GPG-KEY-WAZUH gpgkey: "{{ wazuh_manager_config.repo.gpg }}-5"
gpgcheck: true gpgcheck: true
changed_when: false
when: 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 - name: RedHat/CentOS/Fedora | Install openscap
package: name={{ item }} state=present package: name={{ item }} state=present