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

59 lines
1.9 KiB
YAML

---
- name: Preflight
ansible.builtin.include_tasks:
file: preflight.yml
tags:
- systemd_exporter_install
- systemd_exporter_configure
- systemd_exporter_run
- name: Install
ansible.builtin.include_role:
name: prometheus.prometheus._common
tasks_from: install.yml
vars:
_common_local_cache_path: "{{ systemd_exporter_local_cache_path }}"
_common_binaries: "{{ _systemd_exporter_binaries }}"
_common_binary_install_dir: "{{ systemd_exporter_binary_install_dir }}"
_common_binary_url: "{{ systemd_exporter_binary_url }}"
_common_checksums_url: "{{ systemd_exporter_checksums_url }}"
_common_system_group: "{{ systemd_exporter_system_group }}"
_common_system_user: "{{ systemd_exporter_system_user }}"
_common_config_dir: "{{ systemd_exporter_config_dir }}"
_common_binary_unarchive_opts: ['--strip-components=1']
tags:
- systemd_exporter_install
- name: SELinux
ansible.builtin.include_role:
name: prometheus.prometheus._common
tasks_from: selinux.yml
vars:
_common_selinux_port: "{{ systemd_exporter_web_listen_address | urlsplit('port') }}"
when: ansible_selinux.status == "enabled"
tags:
- systemd_exporter_configure
- name: Configure
ansible.builtin.include_role:
name: prometheus.prometheus._common
tasks_from: configure.yml
vars:
_common_system_user: "{{ systemd_exporter_system_user }}"
_common_system_group: "{{ systemd_exporter_system_group }}"
_common_config_dir: "{{ systemd_exporter_config_dir }}"
_common_tls_server_config: "{{ systemd_exporter_tls_server_config }}"
tags:
- systemd_exporter_configure
- name: Ensure systemd exporter is enabled on boot
become: true
ansible.builtin.systemd:
daemon_reload: true
name: systemd_exporter
enabled: true
state: started
when:
- not ansible_check_mode
tags:
- systemd_exporter_run