diff --git a/tasks/mongodb_exporter.yml b/tasks/mongodb_exporter.yml index 429396b..9868ac0 100644 --- a/tasks/mongodb_exporter.yml +++ b/tasks/mongodb_exporter.yml @@ -43,6 +43,16 @@ when: - prometheus_mongodb_exporter_latest_version.stdout > '0.2' +- name: 'prometheus | mongodb exporter | configuration' + template: + src: conf/prometheus-mongodb-exporter.j2 + dest: /etc/default/prometheus-mongodb-exporter + owner: root + group: root + mode: 0600 + notify: + - 'prometheus | mongodb exporter | restart service' + - name: 'prometheus | mongodb exporter | install unit file to systemd' template: src: systemd/prometheus-mongodb-exporter.service.j2 @@ -58,13 +68,3 @@ daemon_reload: yes enabled: yes name: prometheus-mongodb-exporter.service - -- name: 'prometheus | mongodb exporter | configuration' - template: - src: conf/prometheus-mongodb-exporter.j2 - dest: /etc/default/prometheus-mongodb-exporter - owner: root - group: root - mode: 0600 - notify: - - 'prometheus | mongodb exporter | restart service' diff --git a/tasks/mysqld_exporter.yml b/tasks/mysqld_exporter.yml index 3d9b0b8..0f2f940 100644 --- a/tasks/mysqld_exporter.yml +++ b/tasks/mysqld_exporter.yml @@ -28,6 +28,19 @@ notify: - 'prometheus | mysqld exporter | restart service' +- name: 'prometheus | mysqld exporter | configuration' + template: + src: conf/prometheus-mysqld-exporter.j2 + dest: /etc/default/prometheus-mysqld-exporter + owner: root + group: root + mode: 0600 + when: + - prometheus_mysqld_exporter_user is defined + register: prometheus_mysqld_exporter_configuration + notify: + - 'prometheus | mysqld exporter | restart service' + - name: 'prometheus | mysqld exporter | install unit file to systemd' template: src: systemd/prometheus-mysqld-exporter.service.j2 @@ -41,16 +54,3 @@ daemon_reload: yes enabled: yes name: prometheus-mysqld-exporter.service - -- name: 'prometheus | mysqld exporter | configuration' - template: - src: conf/prometheus-mysqld-exporter.j2 - dest: /etc/default/prometheus-mysqld-exporter - owner: root - group: root - mode: 0600 - when: - - prometheus_mysqld_exporter_user is defined - register: prometheus_mysqld_exporter_configuration - notify: - - 'prometheus | mysqld exporter | restart service' diff --git a/tasks/postgresql_exporter.yml b/tasks/postgresql_exporter.yml index ebf149c..adb537c 100644 --- a/tasks/postgresql_exporter.yml +++ b/tasks/postgresql_exporter.yml @@ -28,6 +28,17 @@ notify: - 'prometheus | postgres exporter | restart service' +- name: 'prometheus | postgres exporter | configuration' + template: + src: conf/prometheus-postgres-exporter.j2 + dest: /etc/default/prometheus-postgres-exporter + owner: root + group: root + mode: 0600 + register: prometheu_postgres_exporter_configuration + notify: + - 'prometheus | postgres exporter | restart service' + - name: 'prometheus | postgres exporter | install unit file to systemd' template: src: systemd/prometheus-postgres-exporter.service.j2 @@ -42,14 +53,3 @@ enabled: yes state: started name: prometheus-postgres-exporter.service - -- name: 'prometheus | postgres exporter | configuration' - template: - src: conf/prometheus-postgres-exporter.j2 - dest: /etc/default/prometheus-postgres-exporter - owner: root - group: root - mode: 0600 - register: prometheu_postgres_exporter_configuration - notify: - - 'prometheus | postgres exporter | restart service'