From f79db054b78e534c83c3365a262c4366da794780 Mon Sep 17 00:00:00 2001 From: Alex Dworjan Date: Thu, 9 Nov 2023 08:56:19 -0500 Subject: [PATCH] added ability to use latest --- .ansible-sign/sha256sum.txt | 6 +++--- .ansible-sign/sha256sum.txt.sig | 22 +++++++++++----------- Nodeexporter.yml | 2 +- Promgraf.yml | 6 +++--- roles/prometheus/tasks/main.yml | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 18 deletions(-) diff --git a/.ansible-sign/sha256sum.txt b/.ansible-sign/sha256sum.txt index adf0c6b..e4e2cb8 100644 --- a/.ansible-sign/sha256sum.txt +++ b/.ansible-sign/sha256sum.txt @@ -4,8 +4,8 @@ ca3f84e14f6aa778003094fd160710543fae3594d76dbc4335d2d0b77245e8ce AnsibleSSP.cod e81d36021af399b6ecafeecde71a8634aacbf718a56ecc5878dec71180d8b704 ELKBuild.yml c8066ae4c79ca812f0abde5b42d4a0bf954a60c88b3eab2149d75d98b567c931 Elastic_restart.yml 936cb966490bb452f91f2cb5b0821ef31c4bc8e62cf2c57a2c11640b60db7e18 MANIFEST.in -e23aacc90b0cced31153f1d5f62e018d3ee59fe03d1b7265cfdb9a10c242e875 Nodeexporter.yml -86472c01b5463af6861466a9f297665d4cbfd9d0941ec3cb2e4a818ecb873969 Promgraf.yml +e0567f633595756e3e406e38295b4b4148929ee67caa748347f56fe47d28fc73 Nodeexporter.yml +cc4ccf59e396b93c14bc40acab5da37699f8c6b587fb476f2377f5ea71f2a5e1 Promgraf.yml 798346886b7ec801a19ed365c33f092e2d5dfb564c034ae886bc51785c89b232 README.md 88223aecf0ee1bfa38a215a481e1dd48054d043a7b52b9fd81243f9699d6142c collections/requirements.yml bcc7a97fdb676c3f94875a674a87d25cd286cabba5820a5bb0a3eb228951b568 email.yml @@ -25,7 +25,7 @@ fde421bd02e9d5d96effcbef92b4657f2ed9283855cebafcb3246c4829882382 roles/kafka/ha b6feda249d68b441cf3dedb363eee0aa78543b6566b276542ec93da0830c5890 roles/kafka/tasks/main.yml 7f721521e6af1761575abf516441d5d4752ca2d0d5908ee2cfbdb0aaa64a53ef roles/prometheus/defaults/main.yml a8355ca3078663433c90e991a1a9622ae2d5b911696aef4a62701ed6a454690c roles/prometheus/handlers/main.yml -4116ff338c5ffed270d770729ff19e4f0a85365be1745f282fd35f50ca660fd6 roles/prometheus/tasks/main.yml +ec14d6c6a08863e3a2852f6f44454b9371db244c3f330cb26f0d75d113e43c05 roles/prometheus/tasks/main.yml 0851b3c911166154035af002069175750e67611180218be24015b2831e166c24 roles/prometheus/tasks/setup-alertmanager.yml ab401c6ab6918566be97cb084100c7c60148fc9c90fd856869737d410a6f0600 roles/prometheus/tasks/setup-facts.yml 0f4c1f016548af369cddc1369030d7e8c827091f83d638249b8d36711e60be50 roles/prometheus/tasks/setup-nodeexporter.yml diff --git a/.ansible-sign/sha256sum.txt.sig b/.ansible-sign/sha256sum.txt.sig index f041c84..d02a5ad 100644 --- a/.ansible-sign/sha256sum.txt.sig +++ b/.ansible-sign/sha256sum.txt.sig @@ -1,14 +1,14 @@ -----BEGIN PGP SIGNATURE----- -iQGzBAABCAAdFiEE/bJvyFHKKJdaZDOLTiIiIXrUDNEFAmVM36AACgkQTiIiIXrU -DNGx/wv/bxBSaWAoaE4FXEwaYQZ7zKRWBrDUM/4QCEL/eB24YU1bnt8eRN1KOSZy -x5rtlUxYZzWnCuNI9d7KDW4ghDwh9wyUl44ElvOFuSUBvhtD1QoW3tMrHybSLml2 -J+JIyVfbkFZL6p0IjC5cw1W+Fj2mrGscrEryXfTwVWpx7axLdDQC+/V5P1hiuqyt -EuR54GsmGZcES/Lz7bVXH2QmKxgOsb++IotWKJoMZh5OOaUXwWFb/wxGhMnbWZvN -OgzrDJsoEs8wp58GZycDunYpeTk3bx5QyDGxME74jVOrYQ+9viEK7tz7IjbYtqTC -NxVJxHSKBYV416s0GxLpVAyIMX1hR7euhSB5Bw8S42yXPOKdbjt+CTJWRDtFujxb -tDnSVm2rMIAmyUVZbMjS+E/pN4Spy51aKfUgcgkU5fXYf3HROmmGeX1mqNE2IkGN -QczXaAAdktPlrBDdEOe0SuKcDTR6UMOhw63hQkF4R937q/CRIHbefmWuFGvi7K3V -O1fNl1hO -=OmbS +iQGzBAABCAAdFiEE/bJvyFHKKJdaZDOLTiIiIXrUDNEFAmVM5PgACgkQTiIiIXrU +DNFilgv/cAXM5KutVF2G4KZmc0vhl0oYK/5ssYfj376nwgBvYKS32hCn2G5pv2vt +Ca+5pbFM6T9Cm7C6TN10MXjqByOzGJcNLcCfaSbAZZt2Zy5vcsSqhZ3GVB9zRw7Y +pzNdbEa4B8kh/JK+Z+hiddgHv/xMshzvP+YX3nsxi0tJVzqfD5qLgUNW/hOISaoi +jTPXyZhjAZtbzrB7nC3cvwZOBJlma37UbbfIgVZZ0XUz2ftBlyiP9wXah31Bonr2 +UqViXeOmi7+ncHd/T49FBBKkYvnB1WceGo0JGcjC47gr2GdWBilanGOap2ljC+f7 +H57H/N0+ci9w2jgOS+BAyPRbNYjCEKdL5ltvurXlHpAYUeLCwmpdW4CWIJ/tBIsh +zWqasmhImtgJZO8+3M6yenOa6Ox3HMrwXmgRTJrbkbFqNtLRFiKpu27JvpY3K1Sc +O8YynI4MZzWMn4HfPRcY6nW5bSxhP490eWp0JxjDGniuRBxtnn1ve5wK1dU9HCZQ +uJP1CsSK +=YHtv -----END PGP SIGNATURE----- diff --git a/Nodeexporter.yml b/Nodeexporter.yml index d58265b..d26b226 100644 --- a/Nodeexporter.yml +++ b/Nodeexporter.yml @@ -4,7 +4,7 @@ vars: - prometheus_components: - node_exporter - - nodeexporter_version: 1.6.1 + - nodeexporter_version: latest roles: - prometheus diff --git a/Promgraf.yml b/Promgraf.yml index 31b3420..f10e559 100644 --- a/Promgraf.yml +++ b/Promgraf.yml @@ -7,9 +7,9 @@ - node_exporter - alertmanager - tower_scrape: 5m - - prometheus_version: 2.47.2 - - alertmanager_version: 0.26.0 - - nodeexporter_version: 1.6.1 + - prometheus_version: latest + - alertmanager_version: latest + - nodeexporter_version: latest # If issues arise with grafana yum install, then manually install # update /etc/yum.repos.d/grafana.repo to the info below diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml index 4cf4bad..5be5064 100644 --- a/roles/prometheus/tasks/main.yml +++ b/roles/prometheus/tasks/main.yml @@ -31,6 +31,39 @@ - name: "Set role facts" ansible.builtin.include_tasks: setup-facts.yml +- name: Discover latest version of prometheus + ansible.builtin.set_fact: + prometheus_version: "{{ (lookup('url', 'https://api.github.com/repos/prometheus/prometheus/releases/latest', headers=_github_api_headers, + split_lines=False) | from_json).get('tag_name') | replace('v', '') }}" + run_once: true + until: prometheus_version is version('0.0.0', '>=') + retries: 10 + when: + - prometheus_version == "latest" + - '"prometheus" in prometheus_components' + +- name: Discover latest version of alertmanager + ansible.builtin.set_fact: + alertmanager_version: "{{ (lookup('url', 'https://api.github.com/repos/prometheus/alertmanager/releases/latest', headers=_github_api_headers, + split_lines=False) | from_json).get('tag_name') | replace('v', '') }}" + run_once: true + until: alertmanager_version is version('0.0.0', '>=') + retries: 10 + when: + - alertmanager_version == "latest" + - '"alertmanager" in prometheus_components' + +- name: Discover latest version of node exporter + ansible.builtin.set_fact: + nodeexporter_version: "{{ (lookup('url', 'https://api.github.com/repos/prometheus/node_exporter/releases/latest', headers=_github_api_headers, + split_lines=False) | from_json).get('tag_name') | replace('v', '') }}" + run_once: true + until: nodeexporter_version is version('0.0.0', '>=') + retries: 10 + when: + - nodeexporter_version == "latest" + - '"node_exporter" in prometheus_components' + - name: "Install Node Exporter" ansible.builtin.include_tasks: setup-nodeexporter.yml when: '"node_exporter" in prometheus_components'