ansible-collection-prometheus/roles/prometheus/tasks/main.yml
gardar 1e4e4c3415
refactor(prometheus): delegate common tasks to _common role
Signed-off-by: gardar <gardar@users.noreply.github.com>
2024-10-15 17:11:12 +00:00

58 lines
1.6 KiB
YAML

---
- name: Preflight
ansible.builtin.include_tasks:
file: preflight.yml
tags:
- prometheus_configure
- prometheus_install
- prometheus_run
- name: Install
ansible.builtin.include_role:
name: prometheus.prometheus._common
tasks_from: install.yml
vars:
_common_local_cache_path: "{{ prometheus_local_cache_path }}"
_common_binaries: "{{ _prometheus_binaries }}"
_common_binary_install_dir: "{{ prometheus_binary_install_dir }}"
_common_binary_url: "{{ prometheus_binary_url }}"
_common_checksums_url: "{{ prometheus_checksums_url }}"
_common_system_group: "{{ prometheus_system_group }}"
_common_system_user: "{{ prometheus_system_user }}"
_common_config_dir: "{{ prometheus_config_dir }}"
_common_binary_unarchive_opts: ['--strip-components=1']
tags:
- prometheus_install
- name: SELinux
ansible.builtin.include_role:
name: prometheus.prometheus._common
tasks_from: selinux.yml
vars:
_common_selinux_port: "{{ prometheus_web_listen_address | urlsplit('port') }}"
when: ansible_selinux.status == "enabled"
tags:
- prometheus_configure
- name: Configure
ansible.builtin.include_tasks:
file: configure.yml
tags:
- prometheus_configure
- name: Ensure prometheus service is started and enabled
become: true
ansible.builtin.systemd:
daemon_reload: true
name: prometheus
state: started
enabled: true
tags:
- prometheus_run
- name: Make sure prometheus service is running
ansible.builtin.service_facts: {}
register: __service_status
until: "__service_status.ansible_facts.services['prometheus.service'].state == 'running'"
retries: 10
delay: 5