move exporter to list

This commit is contained in:
Ludovic Cartier 2021-05-26 10:46:57 +02:00
parent 7e91930523
commit f4e377508a
5 changed files with 4 additions and 31 deletions

View File

@ -11,24 +11,19 @@
- name: 'prometheus | Node exporter'
include_tasks: 'node_exporter.yml'
when:
- prometheus_node_exporter_enable is defined
- prometheus_node_exporter_enable == "true"
- "'node' in {{ prometheus_exporter_packages }}"
- name: 'prometheus | MongoDB exporter'
include_tasks: 'mongodb_exporter.yml'
when:
- prometheus_mongodb_exporter_enable is defined
- prometheus_mongodb_exporter_enable == "true"
- "'mongodb' in {{ prometheus_exporter_packages }}"
- name: 'prometheus | MySQL exporter'
include_tasks: 'mysqld_exporter.yml'
when:
- prometheus_mysqld_exporter_enable is defined
- prometheus_mysqld_exporter_enable == "true"
- "'mysql' in {{ prometheus_exporter_packages }}"
- name: 'prometheus | PostgreSQL exporter'
include_tasks: 'postgresql_exporter.yml'
when:
- prometheus_postgres_exporter_enable is defined
- prometheus_postgres_exporter_enable == "true"
- "'postgresql' in {{ prometheus_exporter_packages }}"

View File

@ -3,14 +3,12 @@
get_url:
url: https://github.com/percona/mongodb_exporter/releases/download/v{{ prometheus_mongodb_exporter_version }}/mongodb_exporter-{{ prometheus_mongodb_exporter_version }}.linux-amd64.tar.gz
dest: /tmp
when: prometheus_mongodb_exporter_enable == "true"
- name: 'prometheus | mongodb exporter | unarchive'
unarchive:
remote_src: yes
src: /tmp/mongodb_exporter-{{ prometheus_mongodb_exporter_version }}.linux-amd64.tar.gz
dest: /tmp
when: prometheus_mongodb_exporter_enable == "true"
- name: 'prometheus | mongodb exporter | move to /usr/local/bin'
copy:
@ -20,7 +18,6 @@
owner: root
group: root
mode: 0755
when: prometheus_mongodb_exporter_enable == "true"
- name: 'prometheus | mongodb exporter | install unit file to systemd'
template:
@ -29,7 +26,6 @@
owner: root
group: root
mode: 0600
when: prometheus_mongodb_exporter_enable == "true"
- name: 'prometheus | mongodb exporter | configure systemd to use service'
systemd:
@ -37,4 +33,3 @@
enabled: yes
state: started
name: prometheus-mongodb-exporter.service
when: prometheus_mongodb_exporter_enable == "true"

View File

@ -3,7 +3,6 @@
get_url:
url: https://github.com/prometheus/mysqld_exporter/releases/download/v{{ prometheus_mysqld_exporter_version }}/mysqld_exporter-{{ prometheus_mysqld_exporter_version }}.linux-amd64.tar.gz
dest: /tmp
when: prometheus_mysqld_exporter_enable == "true"
- name: 'prometheus | mysqld exporter | unarchive'
unarchive:
@ -20,7 +19,6 @@
owner: root
group: root
mode: 0755
when: prometheus_mysqld_exporter_enable == "true"
- name: 'prometheus | mysqld exporter | configuration'
copy:
@ -35,7 +33,6 @@
password={{ prometheus_mysqld_exporter_password }}
when:
- prometheus_mysqld_exporter_user is defined
- prometheus_mysqld_exporter_enable == "true"
register: prometheus_mysqld_exporter_configuration
- name: 'prometheus | mysqld exporter | install unit file to systemd'
@ -45,7 +42,6 @@
owner: root
group: root
mode: 0600
when: prometheus_mysqld_exporter_enable == "true"
- name: 'prometheus | mysqld exporter | configure systemd to use service'
systemd:
@ -53,4 +49,3 @@
enabled: yes
state: started
name: prometheus-mysqld-exporter.service
when: prometheus_mysqld_exporter_enable == "true"

View File

@ -3,14 +3,12 @@
get_url:
url: https://github.com/prometheus/node_exporter/releases/download/v{{ prometheus_node_exporter_version }}/node_exporter-{{ prometheus_node_exporter_version }}.linux-amd64.tar.gz
dest: /tmp
when: prometheus_node_exporter_enable == "true"
- name: 'prometheus | node exporter | unarchive'
unarchive:
remote_src: yes
src: /tmp/node_exporter-{{ prometheus_node_exporter_version }}.linux-amd64.tar.gz
dest: /tmp
when: prometheus_node_exporter_enable == "true"
- name: 'prometheus | node exporter | move to /usr/local/bin'
copy:
@ -20,7 +18,6 @@
owner: root
group: root
mode: 0755
when: prometheus_node_exporter_enable == "true"
- name: 'prometheus | node exporter | install unit file to systemd'
template:
@ -29,7 +26,6 @@
owner: root
group: root
mode: 0600
when: prometheus_node_exporter_enable == "true"
- name: 'prometheus | node exporter | configure systemd to use service'
systemd:
@ -37,4 +33,3 @@
enabled: yes
state: started
name: prometheus-node-exporter.service
when: prometheus_node_exporter_enable == "true"

View File

@ -3,14 +3,12 @@
get_url:
url: https://github.com/prometheus-community/postgres_exporter/releases/download/v{{ prometheus_postgres_exporter_version }}/postgres_exporter-{{ prometheus_postgres_exporter_version }}.linux-amd64.tar.gz
dest: /tmp
when: prometheus_postgres_exporter_enable == "true"
- name: 'prometheus | postgres exporter | unarchive'
unarchive:
remote_src: yes
src: /tmp/postgres_exporter-{{ prometheus_postgres_exporter_version }}.linux-amd64.tar.gz
dest: /tmp
when: prometheus_postgres_exporter_enable == "true"
- name: 'prometheus | postgres exporter | move to /usr/local/bin'
copy:
@ -20,7 +18,6 @@
owner: root
group: root
mode: 0755
when: prometheus_postgres_exporter_enable == "true"
- name: 'prometheus | postgres exporter | configuration'
copy:
@ -34,7 +31,6 @@
user={{ prometheus_postgres_exporter_user }}
password={{ prometheus_postgres_exporter_password }}
when:
- prometheus_postgres_exporter_user is defined
- prometheus_postgres_exporter_enable == "true"
register: prometheus_postgres_exporter_configuration
@ -53,7 +49,6 @@
- prometheus_postgres_exporter_password is defined
- prometheus_postgres_exporter_host is defined
- prometheus_postgres_exporter_port is defined
- prometheus_postgres_exporter_enable == "true"
register: prometheu_postgres_exporter_configuration
- name: 'prometheus | postgres exporter | install unit file to systemd'
@ -63,7 +58,6 @@
owner: root
group: root
mode: 0600
when: prometheus_postgres_exporter_enable == "true"
- name: 'prometheus | postgres exporter | configure systemd to use service'
@ -72,4 +66,3 @@
enabled: yes
state: started
name: prometheus-postgres-exporter.service
when: prometheus_postgres_exporter_enable == "true"