Merge pull request #366 from wazuh/feature-365-custom-packages-installation

Wazuh installation from custom packages (.rpm and .deb)
This commit is contained in:
Jose M. Garcia 2020-02-20 08:38:17 +01:00 committed by GitHub
commit ca2f09072d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 98 additions and 2 deletions

View File

@ -1,6 +1,15 @@
--- ---
wazuh_agent_version: 3.11.3-1 wazuh_agent_version: 3.11.3-1
# Custom packages installation
wazuh_custom_packages_installation_agent_enabled: false
wazuh_custom_packages_installation_agent_deb_url: "https://s3-us-west-1.amazonaws.com/packages-dev.wazuh.com/warehouse/branches/3.12/deb/var/wazuh-agent_3.12.0-0.3319fimreworksqlite_amd64.deb"
wazuh_custom_packages_installation_agent_rpm_url: "https://s3-us-west-1.amazonaws.com/packages-dev.wazuh.com/warehouse/branches/3.12/rpm/var/wazuh-agent-3.12.0-0.3319fimreworksqlite.x86_64.rpm"
# Sources installation
wazuh_agent_sources_installation: wazuh_agent_sources_installation:
enabled: false enabled: false
branch: "v3.11.3" branch: "v3.11.3"

View File

@ -21,6 +21,7 @@
- ansible_distribution == "Ubuntu" - ansible_distribution == "Ubuntu"
- ansible_distribution_major_version | int == 14 - ansible_distribution_major_version | int == 14
- not wazuh_agent_sources_installation.enabled - not wazuh_agent_sources_installation.enabled
- not wazuh_custom_packages_installation_agent_enabled
- name: Debian/Ubuntu | Installing Wazuh repository key - name: Debian/Ubuntu | Installing Wazuh repository key
apt_key: apt_key:
@ -29,6 +30,7 @@
when: when:
- not (ansible_distribution == "Ubuntu" and ansible_distribution_major_version | int == 14) - not (ansible_distribution == "Ubuntu" and ansible_distribution_major_version | int == 14)
- not wazuh_agent_sources_installation.enabled - not wazuh_agent_sources_installation.enabled
- not wazuh_custom_packages_installation_agent_enabled
- name: Debian/Ubuntu | Add Wazuh repositories - name: Debian/Ubuntu | Add Wazuh repositories
apt_repository: apt_repository:
@ -38,6 +40,7 @@
update_cache: true update_cache: true
when: when:
- not wazuh_agent_sources_installation.enabled - not wazuh_agent_sources_installation.enabled
- not wazuh_custom_packages_installation_agent_enabled
- name: Debian/Ubuntu | Set Distribution CIS filename for debian - name: Debian/Ubuntu | Set Distribution CIS filename for debian
set_fact: set_fact:

View File

@ -9,6 +9,10 @@
when: when:
- wazuh_agent_sources_installation.enabled - wazuh_agent_sources_installation.enabled
- include_tasks: "installation_from_custom_packages.yml"
when:
- wazuh_custom_packages_installation_agent_enabled
- name: Linux CentOS/RedHat | Install wazuh-agent - name: Linux CentOS/RedHat | Install wazuh-agent
package: package:
name: wazuh-agent-{{ wazuh_agent_version }} name: wazuh-agent-{{ wazuh_agent_version }}
@ -18,6 +22,7 @@
when: when:
- ansible_os_family|lower == "redhat" - ansible_os_family|lower == "redhat"
- not wazuh_agent_sources_installation.enabled - not wazuh_agent_sources_installation.enabled
- not wazuh_custom_packages_installation_agent_enabled
tags: tags:
- init - init
@ -29,6 +34,7 @@
when: when:
- ansible_os_family|lower != "redhat" - ansible_os_family|lower != "redhat"
- not wazuh_agent_sources_installation.enabled - not wazuh_agent_sources_installation.enabled
- not wazuh_custom_packages_installation_agent_enabled
tags: tags:
- init - init

View File

@ -10,7 +10,8 @@
when: when:
- (ansible_facts['os_family']|lower == 'redhat') and (ansible_distribution|lower != 'amazon') - (ansible_facts['os_family']|lower == 'redhat') and (ansible_distribution|lower != 'amazon')
- (ansible_distribution_major_version|int <= 5) - (ansible_distribution_major_version|int <= 5)
- not wazuh_agent_sources_installation.enabled or not wazuh_api_sources_installation.enabled - not wazuh_agent_sources_installation.enabled
- not wazuh_custom_packages_installation_agent_enabled
register: repo_v5_installed register: repo_v5_installed
- name: RedHat/CentOS/Fedora | Install Wazuh repo - name: RedHat/CentOS/Fedora | Install Wazuh repo
@ -24,6 +25,7 @@
when: when:
- repo_v5_installed is skipped - repo_v5_installed is skipped
- not wazuh_agent_sources_installation.enabled - not wazuh_agent_sources_installation.enabled
- not wazuh_custom_packages_installation_agent_enabled
- name: RedHat/CentOS/Fedora | download Oracle Java RPM - name: RedHat/CentOS/Fedora | download Oracle Java RPM
get_url: get_url:

View File

@ -0,0 +1,16 @@
---
- name: Install Wazuh Agent from .deb packages
apt:
deb: "{{ wazuh_custom_packages_installation_agent_deb_url }}"
state: present
when:
- ansible_os_family|lower == "debian"
- wazuh_custom_packages_installation_agent_enabled
- name: Install Wazuh Agent from .rpm packages
yum:
name: "{{ wazuh_custom_packages_installation_agent_rpm_url }}"
state: present
when:
- ansible_os_family|lower == "redhat"
- wazuh_custom_packages_installation_agent_enabled

View File

@ -4,6 +4,15 @@ wazuh_manager_version: 3.11.3-1
wazuh_manager_fqdn: "wazuh-server" wazuh_manager_fqdn: "wazuh-server"
wazuh_manager_package_state: present wazuh_manager_package_state: present
# Custom packages installation
wazuh_custom_packages_installation_manager_enabled: false
wazuh_custom_packages_installation_manager_deb_url: "https://s3-us-west-1.amazonaws.com/packages-dev.wazuh.com/warehouse/branches/3.12/deb/var/wazuh-manager_3.12.0-0.3319fimreworksqlite_amd64.deb"
wazuh_custom_packages_installation_manager_rpm_url: "https://s3-us-west-1.amazonaws.com/packages-dev.wazuh.com/warehouse/branches/3.12/rpm/var/wazuh-manager-3.12.0-0.3319fimreworksqlite.x86_64.rpm"
wazuh_custom_packages_installation_api_enabled: false
wazuh_custom_packages_installation_api_deb_url: "https://s3-us-west-1.amazonaws.com/packages-dev.wazuh.com/warehouse/branches/3.12/deb/var/wazuh-api_3.12.0-0.3319fimreworksqlite_amd64.deb"
wazuh_custom_packages_installation_api_rpm_url: "https://s3-us-west-1.amazonaws.com/packages-dev.wazuh.com/warehouse/branches/3.12/rpm/var/wazuh-api-3.12.0-0.3319fimreworksqlite.x86_64.rpm"
# Sources installation
wazuh_manager_sources_installation: wazuh_manager_sources_installation:
enabled: false enabled: false
branch: "v3.11.3" branch: "v3.11.3"

View File

@ -24,6 +24,7 @@
- ansible_distribution == "Ubuntu" - ansible_distribution == "Ubuntu"
- ansible_distribution_major_version | int == 14 - ansible_distribution_major_version | int == 14
- not wazuh_manager_sources_installation.enabled or not wazuh_api_sources_installation.enabled - not wazuh_manager_sources_installation.enabled or not wazuh_api_sources_installation.enabled
- not wazuh_custom_packages_installation_manager_enabled or not wazuh_custom_packages_installation_manager_enabled
- name: Debian/Ubuntu | Installing Wazuh repository key - name: Debian/Ubuntu | Installing Wazuh repository key
apt_key: apt_key:
@ -32,6 +33,7 @@
when: when:
- not (ansible_distribution == "Ubuntu" and ansible_distribution_major_version | int == 14) - not (ansible_distribution == "Ubuntu" and ansible_distribution_major_version | int == 14)
- not wazuh_manager_sources_installation.enabled or not wazuh_api_sources_installation.enabled - not wazuh_manager_sources_installation.enabled or not wazuh_api_sources_installation.enabled
- not wazuh_custom_packages_installation_manager_enabled or not wazuh_custom_packages_installation_manager_enabled
- name: Debian/Ubuntu | Add Wazuh repositories - name: Debian/Ubuntu | Add Wazuh repositories
apt_repository: apt_repository:
@ -42,6 +44,7 @@
changed_when: false changed_when: false
when: when:
- not wazuh_manager_sources_installation.enabled or not wazuh_api_sources_installation.enabled - not wazuh_manager_sources_installation.enabled or not wazuh_api_sources_installation.enabled
- not wazuh_custom_packages_installation_manager_enabled or not wazuh_custom_packages_installation_manager_enabled
- name: Debian/Ubuntu | Set Distribution CIS filename for Debian/Ubuntu - name: Debian/Ubuntu | Set Distribution CIS filename for Debian/Ubuntu
set_fact: set_fact:
@ -106,11 +109,16 @@
tags: init tags: init
when: when:
- not wazuh_manager_sources_installation.enabled - not wazuh_manager_sources_installation.enabled
- not wazuh_custom_packages_installation_manager_enabled
- include_tasks: "installation_from_sources.yml" - include_tasks: "installation_from_sources.yml"
when: when:
- wazuh_manager_sources_installation.enabled or wazuh_api_sources_installation.enabled - wazuh_manager_sources_installation.enabled or wazuh_api_sources_installation.enabled
- include_tasks: "installation_from_custom_packages.yml"
when:
- wazuh_custom_packages_installation_manager_enabled or not wazuh_custom_packages_installation_manager_enabled
- name: Debian/Ubuntu | Install wazuh-api - name: Debian/Ubuntu | Install wazuh-api
apt: apt:
name: name:
@ -123,3 +131,4 @@
tags: init tags: init
when: when:
- not wazuh_api_sources_installation.enabled - not wazuh_api_sources_installation.enabled
- not wazuh_custom_packages_installation_manager_enabled

View File

@ -11,6 +11,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 or not wazuh_api_sources_installation.enabled - not wazuh_manager_sources_installation.enabled or not wazuh_api_sources_installation.enabled
- not wazuh_custom_packages_installation_manager_enabled or not wazuh_custom_packages_installation_api_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
@ -24,6 +25,7 @@
when: when:
- repo_v5_manager_installed is skipped - repo_v5_manager_installed is skipped
- not wazuh_manager_sources_installation.enabled or not wazuh_api_sources_installation.enabled - not wazuh_manager_sources_installation.enabled or not wazuh_api_sources_installation.enabled
- not wazuh_custom_packages_installation_manager_enabled or not wazuh_custom_packages_installation_api_enabled
- name: RedHat/CentOS/Fedora | Install openscap - name: RedHat/CentOS/Fedora | Install openscap
package: name={{ item }} state=present package: name={{ item }} state=present
@ -118,6 +120,7 @@
when: when:
- ansible_os_family|lower == "redhat" - ansible_os_family|lower == "redhat"
- not wazuh_manager_sources_installation.enabled - not wazuh_manager_sources_installation.enabled
- not wazuh_custom_packages_installation_manager_enabled
tags: tags:
- init - init
@ -125,6 +128,10 @@
when: when:
- wazuh_manager_sources_installation.enabled or wazuh_api_sources_installation.enabled - wazuh_manager_sources_installation.enabled or wazuh_api_sources_installation.enabled
- include_tasks: "../tasks/installation_from_custom_packages.yml"
when:
- wazuh_custom_packages_installation_manager_enabled or wazuh_custom_packages_installation_api_enabled
- name: CentOS/RedHat/Amazon | Install wazuh-api - name: CentOS/RedHat/Amazon | Install wazuh-api
package: package:
name: "wazuh-api-{{ wazuh_manager_version }}" name: "wazuh-api-{{ wazuh_manager_version }}"
@ -134,6 +141,7 @@
when: when:
- ansible_os_family|lower == "redhat" - ansible_os_family|lower == "redhat"
- not wazuh_api_sources_installation.enabled - not wazuh_api_sources_installation.enabled
- not wazuh_custom_packages_installation_api_enabled
tags: tags:
- init - init

View File

@ -0,0 +1,34 @@
---
- block:
- name: Install Wazuh Manager from .deb packages
apt:
deb: "{{ wazuh_custom_packages_installation_manager_deb_url }}"
state: present
when:
- wazuh_custom_packages_installation_manager_enabled
- name: Install Wazuh API from .deb packages
apt:
deb: "{{ wazuh_custom_packages_installation_api_deb_url }}"
state: present
when:
- wazuh_custom_packages_installation_api_enabled
when:
- ansible_os_family|lower == "debian"
- block:
- name: Install Wazuh Manager from .rpm packages
yum:
name: "{{ wazuh_custom_packages_installation_manager_rpm_url }}"
state: present
when:
- wazuh_custom_packages_installation_manager_enabled
- name: Install Wazuh API from .rpm packages
yum:
name: "{{ wazuh_custom_packages_installation_api_rpm_url }}"
state: present
when:
- wazuh_custom_packages_installation_api_enabled
when:
- ansible_os_family|lower == "redhat"