From 80e0fdcbe8cca477423c9f179ebfd57738e54634 Mon Sep 17 00:00:00 2001 From: Ludovic Cartier Date: Fri, 11 Nov 2022 19:04:14 +0100 Subject: [PATCH] reorg tasks --- .../apache.yml} | 0 .../blackbox.yml} | 0 .../memcached.yml} | 0 .../mongodb.yml} | 0 .../mysqld.yml} | 0 .../{node_exporter.yml => exporter/node.yml} | 0 .../opcache.yml} | 0 .../phpfpm.yml} | 0 .../postgresql.yml} | 0 .../redis.yml} | 0 .../varnish.yml} | 0 tasks/main.yml | 78 ++++++------------- tasks/{ => server}/prometheus.yml | 0 13 files changed, 23 insertions(+), 55 deletions(-) rename tasks/{apache_exporter.yml => exporter/apache.yml} (100%) rename tasks/{blackbox_exporter.yml => exporter/blackbox.yml} (100%) rename tasks/{memcached_exporter.yml => exporter/memcached.yml} (100%) rename tasks/{mongodb_exporter.yml => exporter/mongodb.yml} (100%) rename tasks/{mysqld_exporter.yml => exporter/mysqld.yml} (100%) rename tasks/{node_exporter.yml => exporter/node.yml} (100%) rename tasks/{opcache_exporter.yml => exporter/opcache.yml} (100%) rename tasks/{phpfpm_exporter.yml => exporter/phpfpm.yml} (100%) rename tasks/{postgresql_exporter.yml => exporter/postgresql.yml} (100%) rename tasks/{redis_exporter.yml => exporter/redis.yml} (100%) rename tasks/{varnish_exporter.yml => exporter/varnish.yml} (100%) rename tasks/{ => server}/prometheus.yml (100%) diff --git a/tasks/apache_exporter.yml b/tasks/exporter/apache.yml similarity index 100% rename from tasks/apache_exporter.yml rename to tasks/exporter/apache.yml diff --git a/tasks/blackbox_exporter.yml b/tasks/exporter/blackbox.yml similarity index 100% rename from tasks/blackbox_exporter.yml rename to tasks/exporter/blackbox.yml diff --git a/tasks/memcached_exporter.yml b/tasks/exporter/memcached.yml similarity index 100% rename from tasks/memcached_exporter.yml rename to tasks/exporter/memcached.yml diff --git a/tasks/mongodb_exporter.yml b/tasks/exporter/mongodb.yml similarity index 100% rename from tasks/mongodb_exporter.yml rename to tasks/exporter/mongodb.yml diff --git a/tasks/mysqld_exporter.yml b/tasks/exporter/mysqld.yml similarity index 100% rename from tasks/mysqld_exporter.yml rename to tasks/exporter/mysqld.yml diff --git a/tasks/node_exporter.yml b/tasks/exporter/node.yml similarity index 100% rename from tasks/node_exporter.yml rename to tasks/exporter/node.yml diff --git a/tasks/opcache_exporter.yml b/tasks/exporter/opcache.yml similarity index 100% rename from tasks/opcache_exporter.yml rename to tasks/exporter/opcache.yml diff --git a/tasks/phpfpm_exporter.yml b/tasks/exporter/phpfpm.yml similarity index 100% rename from tasks/phpfpm_exporter.yml rename to tasks/exporter/phpfpm.yml diff --git a/tasks/postgresql_exporter.yml b/tasks/exporter/postgresql.yml similarity index 100% rename from tasks/postgresql_exporter.yml rename to tasks/exporter/postgresql.yml diff --git a/tasks/redis_exporter.yml b/tasks/exporter/redis.yml similarity index 100% rename from tasks/redis_exporter.yml rename to tasks/exporter/redis.yml diff --git a/tasks/varnish_exporter.yml b/tasks/exporter/varnish.yml similarity index 100% rename from tasks/varnish_exporter.yml rename to tasks/exporter/varnish.yml diff --git a/tasks/main.yml b/tasks/main.yml index 3d22040..9d1ec7a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -5,62 +5,30 @@ - name: 'prometheus | requirements' include_tasks: 'requirements.yml' +## prometheus server install - name: 'prometheus | server install' - include_tasks: 'prometheus.yml' + include_tasks: 'server/prometheus.yml' when: - prometheus_server_enable == "true" -- name: 'prometheus | Node exporter' - include_tasks: 'node_exporter.yml' - when: - - "'node' in prometheus_exporter_packages" - -- name: 'prometheus | MongoDB exporter' - include_tasks: 'mongodb_exporter.yml' - when: - - "'mongodb' in prometheus_exporter_packages" - -- name: 'prometheus | MySQL exporter' - include_tasks: 'mysqld_exporter.yml' - when: - - "'mysqld' in prometheus_exporter_packages" - -- name: 'prometheus | PostgreSQL exporter' - include_tasks: 'postgresql_exporter.yml' - when: - - "'postgresql' in prometheus_exporter_packages" - -- name: 'prometheus | PHP Fpm exporter' - include_tasks: 'phpfpm_exporter.yml' - when: - - "'phpfpm' in prometheus_exporter_packages" - -- name: 'prometheus | PHP opcache exporter' - include_tasks: 'opcache_exporter.yml' - when: - - "'opcache' in prometheus_exporter_packages" - -- name: 'prometheus | Apache exporter' - include_tasks: 'apache_exporter.yml' - when: - - "'apache' in prometheus_exporter_packages" - -- name: 'prometheus | Varnish exporter' - include_tasks: 'varnish_exporter.yml' - when: - - "'varnish' in prometheus_exporter_packages" - -- name: 'prometheus | Blackbox exporter' - include_tasks: 'blackbox_exporter.yml' - when: - - "'blackbox' in prometheus_exporter_packages" - -- name: 'prometheus | Redis exporter' - include_tasks: 'redis_exporter.yml' - when: - - "'redis' in prometheus_exporter_packages" - -- name: 'prometheus | Memcached exporter' - include_tasks: 'memcached_exporter.yml' - when: - - "'memcached' in prometheus_exporter_packages" +## include exporter install +- name: 'prometheus | exporter install' + vars: + service: "{{ item }}" + include_tasks: "exporter/{{ item }}.yml" + tags: + - prometheus_node_exporter + - prometheus_mysqld_exporter + - prometheus_postgresql_exporter + - prometheus_mongodb_exporter + - prometheus_apache_exporter + - prometheus_haproxy_exporter + - prometheus_varnish_exporter + - prometheus_redis_exporter + - prometheus_memcached_exporter + - prometheus_phpfpm_exporter + - prometheus_opcache_exporter + - prometheus_blackbox_exporter + - prometheus_kong_exporter + with_items: + - "{{ prometheus_exporter_packages }}" diff --git a/tasks/prometheus.yml b/tasks/server/prometheus.yml similarity index 100% rename from tasks/prometheus.yml rename to tasks/server/prometheus.yml