ansible-collection-prometheus/roles/nginx_exporter/tasks/main.yml
Oleg Klyuchkin 830e69814f
feat: Add nginx_exporter role
Signed-off-by: anviar <oleg.kluchkin+github@gmail.com>
2024-02-09 08:49:59 +03:00

63 lines
1.6 KiB
YAML

---
- name: Preflight
ansible.builtin.include_tasks:
file: preflight.yml
apply:
tags:
- nginx_exporter_install
- nginx_exporter_configure
- nginx_exporter_run
tags:
- nginx_exporter_install
- nginx_exporter_configure
- nginx_exporter_run
- name: Install
ansible.builtin.include_tasks:
file: install.yml
apply:
become: true
tags:
- nginx_exporter_install
when:
( not __nginx_exporter_is_installed.stat.exists ) or
( (__nginx_exporter_current_version_output.stderr_lines | length > 0)
and (__nginx_exporter_current_version_output.stderr_lines[0].split(" ")[2] != nginx_exporter_version) ) or
( (__nginx_exporter_current_version_output.stdout_lines | length > 0)
and (__nginx_exporter_current_version_output.stdout_lines[0].split(" ")[2] != nginx_exporter_version) ) or
( nginx_exporter_binary_local_dir | length > 0 )
tags:
- nginx_exporter_install
- name: SELinux
ansible.builtin.include_tasks:
file: selinux.yml
apply:
become: true
tags:
- nginx_exporter_configure
when: ansible_selinux.status == "enabled"
tags:
- nginx_exporter_configure
- name: Configure
ansible.builtin.include_tasks:
file: configure.yml
apply:
become: true
tags:
- nginx_exporter_configure
tags:
- nginx_exporter_configure
- name: Ensure nginx_exporter is enabled on boot
become: true
ansible.builtin.systemd:
daemon_reload: true
name: nginx_exporter
enabled: true
state: started
when:
- not ansible_check_mode
tags:
- nginx_exporter_run