From 29080ab4f6cfbcb9e55cfdcab3f6e569c88e814a Mon Sep 17 00:00:00 2001 From: Andrew Bonney Date: Fri, 14 Jan 2022 13:58:34 +0000 Subject: [PATCH] Add support for apt package pinning Adds variables to pin elastic package versions to ensure they can't move out of sequence. An individual variable is added for journalbeat given it is withdrawn from 7.16. Includes a version bump to a more recent 7.x release which is still compatible with this role Change-Id: I5e6c42398acf70012bf879f41953d409abbd89f4 --- elk_metrics_7x/ansible-role-requirements.yml | 4 +++ .../roles/elastic_ilm/defaults/main.yml | 2 +- .../roles/elastic_repositories/meta/main.yml | 3 +- elk_metrics_7x/vars/variables.yml | 31 ++++++++++++++++++- 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/elk_metrics_7x/ansible-role-requirements.yml b/elk_metrics_7x/ansible-role-requirements.yml index 068b7712..fe954a55 100644 --- a/elk_metrics_7x/ansible-role-requirements.yml +++ b/elk_metrics_7x/ansible-role-requirements.yml @@ -11,3 +11,7 @@ scm: git src: https://opendev.org/openstack/ansible-config_template version: master +- name: apt_package_pinning + scm: git + src: https://opendev.org/openstack/openstack-ansible-apt_package_pinning + version: master diff --git a/elk_metrics_7x/roles/elastic_ilm/defaults/main.yml b/elk_metrics_7x/roles/elastic_ilm/defaults/main.yml index 7f587579..c343488f 100644 --- a/elk_metrics_7x/roles/elastic_ilm/defaults/main.yml +++ b/elk_metrics_7x/roles/elastic_ilm/defaults/main.yml @@ -1,4 +1,4 @@ -beat_version: "7.3.2" +beat_version: "7.15.2" default_ilm_rollover_max_size: "30G" default_ilm_rollover_max_age: "15d" default_ilm_delete_min_age: "30d" diff --git a/elk_metrics_7x/roles/elastic_repositories/meta/main.yml b/elk_metrics_7x/roles/elastic_repositories/meta/main.yml index 5df9b15c..acf3a89e 100644 --- a/elk_metrics_7x/roles/elastic_repositories/meta/main.yml +++ b/elk_metrics_7x/roles/elastic_repositories/meta/main.yml @@ -30,4 +30,5 @@ galaxy_info: - development - elasticsearch - elastic-stack -dependencies: [] +dependencies: + - role: apt_package_pinning diff --git a/elk_metrics_7x/vars/variables.yml b/elk_metrics_7x/vars/variables.yml index 2aa86f36..8eea68b7 100644 --- a/elk_metrics_7x/vars/variables.yml +++ b/elk_metrics_7x/vars/variables.yml @@ -412,7 +412,7 @@ elastic_beats: skydive: hosts: "{{ (((groups['skydive_analyzers'] | default([])) | length) > 0) | ternary((groups['hosts'] | default([])), []) }}" -beat_version: "7.3.2" +beat_version: "7.15.2" default_ilm_rollover_max_size: "30G" default_ilm_rollover_max_age: "15d" default_ilm_delete_min_age: "30d" @@ -430,3 +430,32 @@ default_ilm_policy: delete: {} default_ilm_policy_filename: "default-ilm-policy.json" default_ilm_policy_file_location: "/tmp" + +# elastic_apt_pin_file_name: "elasticsearch.pref" +# elastic_apt_pin_version: "{{ beat_version }}" +# elastic_apt_pin_packages: [] + +_elastic_apt_pin_packages: + - version: "{{ elastic_apt_pin_version_journalbeat | default(elastic_apt_pin_version | default(beat_version)) }}" + package: "journalbeat" + - version: "{{ elastic_apt_pin_version | default(beat_version) }}" + package: "packetbeat" + - version: "{{ elastic_apt_pin_version | default(beat_version) }}" + package: "apm-server" + - version: "{{ elastic_apt_pin_version | default(beat_version) }}" + package: "metricbeat" + - version: "{{ elastic_apt_pin_version | default(beat_version) }}" + package: "auditbeat" + - version: "{{ elastic_apt_pin_version | default(beat_version) }}" + package: "filebeat" + - version: "1:{{ elastic_apt_pin_version | default(beat_version) }}-1" + package: "logstash" + - version: "{{ elastic_apt_pin_version | default(beat_version) }}" + package: "elasticsearch" + - version: "{{ elastic_apt_pin_version | default(beat_version) }}" + package: "kibana" + - version: "{{ elastic_apt_pin_version | default(beat_version) }}" + package: "heartbeat-elastic" + +apt_package_pinning_file_name: "{{ elastic_apt_pin_file_name | default('elasticsearch.pref') }}" +apt_pinned_packages: "{{ elastic_apt_pin_packages | default(_elastic_apt_pin_packages) }}"