mirror of
https://github.com/prometheus-community/ansible
synced 2025-02-16 20:58:26 +00:00
59 lines
1.9 KiB
YAML
59 lines
1.9 KiB
YAML
---
|
|
- name: Common preflight
|
|
ansible.builtin.include_role:
|
|
name: prometheus.prometheus._common
|
|
tasks_from: preflight.yml
|
|
vars:
|
|
_common_web_listen_address: "{{ pushgateway_web_listen_address }}"
|
|
|
|
- name: Assert that used version supports listen address type
|
|
ansible.builtin.assert:
|
|
that:
|
|
- >-
|
|
pushgateway_web_listen_address is string
|
|
or
|
|
(
|
|
pushgateway_version is version('1.5.0', '>=') and
|
|
pushgateway_web_listen_address | type_debug == "list"
|
|
)
|
|
|
|
- name: Assert that TLS config is correct
|
|
when: pushgateway_tls_server_config | length > 0
|
|
block:
|
|
- name: Assert that TLS key and cert path are set
|
|
ansible.builtin.assert:
|
|
that:
|
|
- "pushgateway_tls_server_config.cert_file is defined"
|
|
- "pushgateway_tls_server_config.key_file is defined"
|
|
|
|
- name: Check existence of TLS cert file
|
|
ansible.builtin.stat:
|
|
path: "{{ pushgateway_tls_server_config.cert_file }}"
|
|
register: __pushgateway_cert_file
|
|
|
|
- name: Check existence of TLS key file
|
|
ansible.builtin.stat:
|
|
path: "{{ pushgateway_tls_server_config.key_file }}"
|
|
register: __pushgateway_key_file
|
|
|
|
- name: Assert that TLS key and cert are present
|
|
ansible.builtin.assert:
|
|
that:
|
|
- "__pushgateway_cert_file.stat.exists"
|
|
- "__pushgateway_key_file.stat.exists"
|
|
|
|
- name: Discover latest version
|
|
ansible.builtin.set_fact:
|
|
pushgateway_version: "{{ (lookup('url', 'https://api.github.com/repos/{{ _pushgateway_repo }}/releases/latest', headers=_github_api_headers,
|
|
split_lines=False) | from_json).get('tag_name') | replace('v', '') }}"
|
|
run_once: true
|
|
until: pushgateway_version is version('0.0.0', '>=')
|
|
retries: 10
|
|
when:
|
|
- pushgateway_version == "latest"
|
|
tags:
|
|
- pushgateway
|
|
- install
|
|
- pushgateway_install
|
|
- download
|
|
- pushgateway_download
|