From 778002714cb805aa5d2bb9be13343191856d4551 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Thu, 14 Jun 2018 11:50:48 -0500 Subject: [PATCH] Add upgrade task options To ensure users can upgrade packages the variable `"{{ elk_package_state | default('present') }}"` has been added to all package installs. Change-Id: I0238d9e1ed991cb1480bd924f2d5a09687890da3 Signed-off-by: Kevin Carter --- elk_metrics_6x/common_task_install_elk_repo.yml | 2 +- elk_metrics_6x/installElastic.yml | 4 ++-- elk_metrics_6x/installKibana.yml | 4 ++-- elk_metrics_6x/installLogstash.yml | 4 ++-- elk_metrics_6x/readme.rst | 12 ++++++++++++ elk_metrics_6x/vars/variables.yml | 2 +- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/elk_metrics_6x/common_task_install_elk_repo.yml b/elk_metrics_6x/common_task_install_elk_repo.yml index f4a364b4..3fe3187f 100644 --- a/elk_metrics_6x/common_task_install_elk_repo.yml +++ b/elk_metrics_6x/common_task_install_elk_repo.yml @@ -16,7 +16,7 @@ - name: add Elastic search public GPG key (same for Metricsbeat) apt_key: url: "https://artifacts.elastic.co/GPG-KEY-elasticsearch" - state: "{{ elk_package_state | default('present') }}" + state: "{{ ((elk_package_state | default('present')) == 'absent') | ternary('absent', 'present') }}" - name: enable apt-transport-https apt: diff --git a/elk_metrics_6x/installElastic.yml b/elk_metrics_6x/installElastic.yml index 3fd06886..1afdc5ea 100644 --- a/elk_metrics_6x/installElastic.yml +++ b/elk_metrics_6x/installElastic.yml @@ -68,7 +68,7 @@ - name: Ensure Java is installed apt: name: openjdk-8-jre - state: present + state: "{{ elk_package_state | default('present') }}" install_recommends: yes update_cache: yes @@ -77,7 +77,7 @@ - name: Ensure Elastic search is installed apt: name: elasticsearch - state: present + state: "{{ elk_package_state | default('present') }}" update_cache: yes - name: Drop elasticsearch conf file diff --git a/elk_metrics_6x/installKibana.yml b/elk_metrics_6x/installKibana.yml index 50685caa..dfb88fc4 100644 --- a/elk_metrics_6x/installKibana.yml +++ b/elk_metrics_6x/installKibana.yml @@ -13,7 +13,7 @@ - name: Ensure Nginx is installed apt: name: "{{ item }}" - state: present + state: "{{ elk_package_state | default('present') }}" update_cache: yes with_items: - nginx @@ -42,7 +42,7 @@ - name: Ensure kibana is installed apt: name: kibana - state: present + state: "{{ elk_package_state | default('present') }}" update_cache: yes - name: Drop kibana conf file diff --git a/elk_metrics_6x/installLogstash.yml b/elk_metrics_6x/installLogstash.yml index b2fc34de..158a763f 100644 --- a/elk_metrics_6x/installLogstash.yml +++ b/elk_metrics_6x/installLogstash.yml @@ -56,14 +56,14 @@ - name: Ensure Java is installed apt: name: openjdk-8-jre - state: present + state: "{{ elk_package_state | default('present') }}" install_recommends: yes update_cache: yes - name: Ensure Logstash is installed apt: name: logstash - state: present + state: "{{ elk_package_state | default('present') }}" update_cache: yes - name: Drop Logstash conf for beats input diff --git a/elk_metrics_6x/readme.rst b/elk_metrics_6x/readme.rst index 04932c32..603aa1af 100644 --- a/elk_metrics_6x/readme.rst +++ b/elk_metrics_6x/readme.rst @@ -390,6 +390,18 @@ Example command using the embedded Ansible from within the grafana directory. -e 'galera_address={{ internal_lb_vip_address }}' +Upgrading the cluster +--------------------- + +To upgrade the packages throughout the elastic search cluster set the package +state variable, `elk_package_state`, to latest. + +.. code-block:: bash + + cd /opt/openstack-ansible-ops/elk_metrics_6x + ansible-playbook site.yml $USER_VARS -e 'elk_package_state="latest"' + + Trouble shooting ---------------- diff --git a/elk_metrics_6x/vars/variables.yml b/elk_metrics_6x/vars/variables.yml index 32f33fee..6110ef6c 100644 --- a/elk_metrics_6x/vars/variables.yml +++ b/elk_metrics_6x/vars/variables.yml @@ -1,7 +1,7 @@ # elk apt repo elk_repo: repo: 'deb https://artifacts.elastic.co/packages/6.x/apt stable main' - state: "{{ elk_package_state | default('present') }}" + state: "{{ ((elk_package_state | default('present')) == 'absent') | ternary('absent', 'present') }}" #metricbeats monitoring endpoints elastic_metricbeat_rabbitmq_monitoring_hosts: '"localhost:15672"'