Merge pull request #251 from wazuh/fix-upgrade-elk

Fix Ansible upgrade from 6.x to 7.x
This commit is contained in:
Manuel J. Bernal 2019-09-26 18:28:05 +02:00 committed by GitHub
commit 9dbb5f415e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 11 deletions

View File

@ -38,7 +38,7 @@
apt_repository: apt_repository:
repo: 'deb https://artifacts.elastic.co/packages/7.x/apt stable main' repo: 'deb https://artifacts.elastic.co/packages/7.x/apt stable main'
state: present state: present
filename: 'elastic_repo' filename: 'elastic_repo_7'
update_cache: true update_cache: true
changed_when: false changed_when: false

View File

@ -2,7 +2,7 @@
- name: RedHat/CentOS/Fedora | Install Elastic repo - name: RedHat/CentOS/Fedora | Install Elastic repo
yum_repository: yum_repository:
name: elastic_repo name: elastic_repo_7
description: Elastic repository for 7.x packages description: Elastic repository for 7.x packages
baseurl: https://artifacts.elastic.co/packages/7.x/yum baseurl: https://artifacts.elastic.co/packages/7.x/yum
gpgkey: https://artifacts.elastic.co/GPG-KEY-elasticsearch gpgkey: https://artifacts.elastic.co/GPG-KEY-elasticsearch

View File

@ -17,7 +17,7 @@
apt_repository: apt_repository:
repo: 'deb https://artifacts.elastic.co/packages/7.x/apt stable main' repo: 'deb https://artifacts.elastic.co/packages/7.x/apt stable main'
state: present state: present
filename: 'elastic_repo' filename: 'elastic_repo_7'
update_cache: true update_cache: true
changed_when: false changed_when: false

View File

@ -1,7 +1,7 @@
--- ---
- name: RedHat/CentOS/Fedora | Install Elastic repo - name: RedHat/CentOS/Fedora | Install Elastic repo
yum_repository: yum_repository:
name: elastic_repo name: elastic_repo_7
description: Elastic repository for 7.x packages description: Elastic repository for 7.x packages
baseurl: https://artifacts.elastic.co/packages/7.x/yum baseurl: https://artifacts.elastic.co/packages/7.x/yum
gpgkey: https://artifacts.elastic.co/GPG-KEY-elasticsearch gpgkey: https://artifacts.elastic.co/GPG-KEY-elasticsearch

View File

@ -74,24 +74,27 @@
tags: configure tags: configure
- name: Checking Wazuh-APP version - name: Checking Wazuh-APP version
shell: | shell: >-
set -o pipefail grep -c -E 'version.*{{ elastic_stack_version }}' /usr/share/kibana/plugins/wazuh/package.json
grep -c -E 'version.*{{ elastic_stack_version }}' /usr/share/kibana/plugins/wazuh/package.json | xargs echo
args: args:
executable: /bin/bash executable: /bin/bash
removes: /usr/share/kibana/plugins/wazuh/package.json removes: /usr/share/kibana/plugins/wazuh/package.json
register: wazuh_app_verify register: wazuh_app_verify
changed_when: false changed_when: false
tags: install failed_when:
- wazuh_app_verify.rc != 0
- wazuh_app_verify.rc != 1
- name: Removing old Wazuh-APP - name: Removing old Wazuh-APP
command: /usr/share/kibana/bin/kibana-plugin remove wazuh command: /usr/share/kibana/bin/kibana-plugin --allow-root remove wazuh
when: wazuh_app_verify.stdout == "0" when: wazuh_app_verify.rc == 1
tags: install tags: install
- name: Removing bundles - name: Removing bundles
file: path=/usr/share/kibana/optimize/bundles state=absent file: path=/usr/share/kibana/optimize/bundles state=absent
when: wazuh_app_verify.stdout == "0" become: yes
become_user: kibana
when: wazuh_app_verify.rc == 1
tags: install tags: install
- name: Install Wazuh-APP (can take a while) - name: Install Wazuh-APP (can take a while)