Repositories variables unified

This commit is contained in:
Gonzalo Acuña 2022-04-26 09:59:33 -03:00
parent a6093aedd9
commit 31d3cd64d1
No known key found for this signature in database
GPG Key ID: 646BA79A313A2270
16 changed files with 52 additions and 44 deletions

View File

@ -1,7 +1,7 @@
--- ---
filebeat_version: 7.10.2 filebeat_version: 7.10.2
wazuh_template_branch: v4.3.0 wazuh_template_branch: 4.3
filebeat_node_name: node-1 filebeat_node_name: node-1

View File

@ -55,17 +55,10 @@ wazuh_winagent_config:
auth_path_x86: C:\'Program Files (x86)'\ossec-agent\agent-auth.exe auth_path_x86: C:\'Program Files (x86)'\ossec-agent\agent-auth.exe
check_md5: True check_md5: True
md5: 8ffa75d13280f1aa6ffca54f4273df4d md5: 8ffa75d13280f1aa6ffca54f4273df4d
wazuh_winagent_config_url: https://packages.wazuh.com/4.x/windows/wazuh-agent-4.3.0-1.msi
wazuh_winagent_package_name: wazuh-agent-4.3.0-1.msi wazuh_winagent_package_name: wazuh-agent-4.3.0-1.msi
wazuh_dir: "/var/ossec" wazuh_dir: "/var/ossec"
wazuh_agent_repo:
apt: 'deb https://packages.wazuh.com/4.x/apt/ stable main'
yum: 'https://packages.wazuh.com/4.x/yum/'
gpg: 'https://packages.wazuh.com/key/GPG-KEY-WAZUH'
key_id: '0DCFCA5547B19D2A6099506096B3EE5F29111145'
# This is deprecated, see: wazuh_agent_address # This is deprecated, see: wazuh_agent_address
wazuh_agent_nat: false wazuh_agent_nat: false
@ -367,7 +360,7 @@ wazuh_agent_log_format: 'plain'
# wazuh_agent_config # wazuh_agent_config
wazuh_agent_config_defaults: wazuh_agent_config_defaults:
repo: '{{ wazuh_agent_repo }}' repo: '{{ wazuh_repo }}'
active_response: '{{ wazuh_agent_active_response }}' active_response: '{{ wazuh_agent_active_response }}'
log_format: '{{ wazuh_agent_log_format }}' log_format: '{{ wazuh_agent_log_format }}'
client_buffer: '{{ wazuh_agent_client_buffer }}' client_buffer: '{{ wazuh_agent_client_buffer }}'

View File

@ -14,7 +14,7 @@
become: true become: true
shell: | shell: |
set -o pipefail set -o pipefail
curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | apt-key add - curl -s {{ wazuh_agent_config.repo.gpg }} | apt-key add -
args: args:
warn: false warn: false
executable: /bin/bash executable: /bin/bash

View File

@ -1,5 +1,15 @@
--- ---
- name: Get latest wazuh release
shell: "curl --silent https://api.github.com/repos/wazuh/wazuh/releases/latest | grep '\"tag_name\":' | sed -E 's/.*\"([^\"]+)\".*/\\1/'| cut -c 2-"
register: wazuh_latest_release
- include_vars: ../../vars/repo.yml
when: "{{ wazuh_latest_release.stdout is version(wazuh_agent_version, operator='ge') }}"
- include_vars: ../../vars/repo_dev.yml
when: "{{ wazuh_latest_release.stdout is version(wazuh_agent_version, operator='lt') }}"
- name: Overlay wazuh_agent_config on top of defaults - name: Overlay wazuh_agent_config on top of defaults
set_fact: set_fact:
wazuh_agent_config: '{{ wazuh_agent_config_defaults | combine(config_layer, recursive=True) }}' wazuh_agent_config: '{{ wazuh_agent_config_defaults | combine(config_layer, recursive=True) }}'

View File

@ -37,12 +37,6 @@ wazuh_manager_sources_installation:
threads: "2" threads: "2"
wazuh_dir: "/var/ossec" wazuh_dir: "/var/ossec"
wazuh_manager_repo:
apt: 'deb https://packages.wazuh.com/4.x/apt/ stable main'
yum: 'https://packages.wazuh.com/4.x/yum/'
gpg: 'https://packages.wazuh.com/key/GPG-KEY-WAZUH'
key_id: '0DCFCA5547B19D2A6099506096B3EE5F29111145'
########################################## ##########################################
### Wazuh-OSSEC ### Wazuh-OSSEC
@ -421,7 +415,7 @@ wazuh_manager_config_overlay: true
## Other/Wrappers ## Other/Wrappers
wazuh_manager_config_defaults: wazuh_manager_config_defaults:
repo: '{{ wazuh_manager_repo }}' repo: '{{ wazuh_repo }}'
json_output: '{{ wazuh_manager_json_output }}' json_output: '{{ wazuh_manager_json_output }}'
alerts_log: '{{ wazuh_manager_alerts_log }}' alerts_log: '{{ wazuh_manager_alerts_log }}'
logall: '{{ wazuh_manager_logall }}' logall: '{{ wazuh_manager_logall }}'

View File

@ -16,7 +16,7 @@
become: true become: true
shell: | shell: |
set -o pipefail set -o pipefail
curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | apt-key add - curl -s {{ wazuh_manager_config.repo.gpg }} | apt-key add -
args: args:
warn: false warn: false
executable: /bin/bash executable: /bin/bash

View File

@ -1,5 +1,15 @@
--- ---
- name: Get latest wazuh release
shell: "curl --silent https://api.github.com/repos/wazuh/wazuh/releases/latest | grep '\"tag_name\":' | sed -E 's/.*\"([^\"]+)\".*/\\1/'| cut -c 2-"
register: wazuh_latest_release
- include_vars: ../../vars/repo.yml
when: "{{ wazuh_latest_release.stdout is version(wazuh_manager_version, operator='ge') }}"
- include_vars: ../../vars/repo_dev.yml
when: "{{ wazuh_latest_release.stdout is version(wazuh_manager_version, operator='lt') }}"
- name: Overlay wazuh_manager_config on top of defaults - name: Overlay wazuh_manager_config on top of defaults
set_fact: set_fact:
wazuh_manager_config: '{{ wazuh_manager_config_defaults | combine(config_layer, recursive=True) }}' wazuh_manager_config: '{{ wazuh_manager_config_defaults | combine(config_layer, recursive=True) }}'

View File

@ -2,7 +2,7 @@
- name: Debian/Ubuntu | Remove Wazuh repository. - name: Debian/Ubuntu | Remove Wazuh repository.
apt_repository: apt_repository:
repo: deb https://packages.wazuh.com/4.x/apt {{ ansible_distribution_release }} main repo: "{{ wazuh_manager_config.repo.apt }}"
state: absent state: absent
changed_when: false changed_when: false
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"

View File

@ -15,16 +15,6 @@ indexer_cluster_nodes:
# The Wazuh dashboard package repository # The Wazuh dashboard package repository
dashboard_version: "4.3.0" dashboard_version: "4.3.0"
package_repos:
yum:
dashboard:
baseurl: 'https://packages.wazuh.com/4.x/yum/'
gpg: 'https://packages.wazuh.com/key/GPG-KEY-WAZUH'
apt:
dashboard:
baseurl: 'deb https://packages.wazuh.com/4.x/apt/ stable main'
gpg: 'https://packages.wazuh.com/key/GPG-KEY-WAZUH'
# API credentials # API credentials
wazuh_api_credentials: wazuh_api_credentials:
- id: "default" - id: "default"

View File

@ -4,12 +4,12 @@
- include_vars: debian.yml - include_vars: debian.yml
- name: Add apt repository signing key - name: Add apt repository signing key
apt_key: apt_key:
url: "{{ package_repos.apt.dashboard.gpg }}" url: "{{ wazuh_repo.gpg }}"
state: present state: present
- name: Debian systems | Add Wazuh dashboard repo - name: Debian systems | Add Wazuh dashboard repo
apt_repository: apt_repository:
repo: "{{ package_repos.apt.dashboard.baseurl }}" repo: "{{ wazuh_repo.apt }}"
state: present state: present
update_cache: yes update_cache: yes

View File

@ -6,8 +6,8 @@
file: wazuh file: wazuh
name: wazuh_repo name: wazuh_repo
description: Wazuh yum repository description: Wazuh yum repository
baseurl: "{{ package_repos.yum.dashboard.baseurl }}" baseurl: "{{ wazuh_repo.yum }}"
gpgkey: "{{ package_repos.yum.dashboard.gpg }}" gpgkey: "{{ wazuh_repo.gpg }}"
gpgcheck: true gpgcheck: true
- name: Install Wazuh dashboard - name: Install Wazuh dashboard

View File

@ -1,4 +1,13 @@
--- ---
- name: Get latest wazuh release
shell: "curl --silent https://api.github.com/repos/wazuh/wazuh/releases/latest | grep '\"tag_name\":' | sed -E 's/.*\"([^\"]+)\".*/\\1/'| cut -c 2-"
register: wazuh_latest_release
- include_vars: ../../vars/repo.yml
when: "{{ wazuh_latest_release.stdout is version(dashboard_version, operator='ge') }}"
- include_vars: ../../vars/repo_dev.yml
when: "{{ wazuh_latest_release.stdout is version(dashboard_version, operator='lt') }}"
- import_tasks: RedHat.yml - import_tasks: RedHat.yml
when: ansible_os_family == 'RedHat' when: ansible_os_family == 'RedHat'

View File

@ -28,14 +28,7 @@ domain_name: wazuh.com
# The Wazuh indexer package repository # The Wazuh indexer package repository
package_repos: package_repos:
yum:
indexer:
baseurl: 'https://packages.wazuh.com/4.x/yum/'
gpg: 'https://packages.wazuh.com/key/GPG-KEY-WAZUH'
apt: apt:
indexer:
baseurl: 'deb https://packages.wazuh.com/4.x/apt/ stable main'
gpg: 'https://packages.wazuh.com/key/GPG-KEY-WAZUH'
openjdk: openjdk:
baseurl: 'deb http://deb.debian.org/debian stretch-backports main' baseurl: 'deb http://deb.debian.org/debian stretch-backports main'

View File

@ -39,12 +39,12 @@
block: block:
- name: Add apt repository signing key - name: Add apt repository signing key
apt_key: apt_key:
url: "{{ package_repos.apt.indexer.gpg }}" url: "{{ wazuh_repo.apt.gpg }}"
state: present state: present
- name: Add Wazuh indexer repository - name: Add Wazuh indexer repository
apt_repository: apt_repository:
repo: "{{ package_repos.apt.indexer.baseurl }}" repo: "{{ wazuh_repo.apt }}"
state: present state: present
filename: 'wazuh-indexer' filename: 'wazuh-indexer'
update_cache: yes update_cache: yes

View File

@ -6,8 +6,8 @@
file: wazuh file: wazuh
name: wazuh_repo name: wazuh_repo
description: Wazuh yum repository description: Wazuh yum repository
baseurl: "{{ package_repos.yum.indexer.baseurl }}" baseurl: "{{ wazuh_repo.yum }}"
gpgkey: "{{ package_repos.yum.indexer.gpg }}" gpgkey: "{{ wazuh_repo.gpg }}"
gpgcheck: true gpgcheck: true
changed_when: false changed_when: false

View File

@ -1,4 +1,13 @@
--- ---
- name: Get latest wazuh release
shell: "curl --silent https://api.github.com/repos/wazuh/wazuh/releases/latest | grep '\"tag_name\":' | sed -E 's/.*\"([^\"]+)\".*/\\1/'| cut -c 2-"
register: wazuh_latest_release
- include_vars: ../../vars/repo.yml
when: "{{ wazuh_latest_release.stdout is version(indexer_version, operator='ge') }}"
- include_vars: ../../vars/repo_dev.yml
when: "{{ wazuh_latest_release.stdout is version(indexer_version, operator='lt') }}"
- import_tasks: local_actions.yml - import_tasks: local_actions.yml
when: when: