commit c3e49bc77300982bedbebe5826e664015ed4a3f1
parent 231d7e41bfc23451182cfce988c9054c2591d725
Author: Leah (ctucx) <leah@ctu.cx>
Date: Mon, 22 Feb 2021 17:04:30 +0100
parent 231d7e41bfc23451182cfce988c9054c2591d725
Author: Leah (ctucx) <leah@ctu.cx>
Date: Mon, 22 Feb 2021 17:04:30 +0100
roles/influxdb: improvements
7 files changed, 33 insertions(+), 28 deletions(-)
diff --git a/roles/influxdb/handlers/main.yml b/roles/influxdb/handlers/main.yml @@ -0,0 +1,17 @@ +--- + +- name: "[OpenRC] Restart service: influxdb (to deploy config changes)" + service: + name: influxdb + state: restarted + when: + - ansible_service_mgr == "openrc" + listen: "Restart influxdb" + +- name: "[systemd] Restart service: influxdb (to deploy config changes)" + systemd: + name: influxdb + state: restarted + when: + - ansible_service_mgr == "systemd" + listen: "Restart influxdb"
diff --git a/roles/influxdb/meta/main.yml b/roles/influxdb/meta/main.yml @@ -0,0 +1,6 @@ +--- + +dependencies: + - role: nginx + when: + - services.influx.nginx.enable is true
diff --git a/roles/influxdb/tasks/install.yml b/roles/influxdb/tasks/install.yml @@ -4,7 +4,6 @@ apk: name: influxdb state: present - update_cache: yes when: - ansible_distribution == "Alpine" @@ -15,7 +14,6 @@ - python-requests - python-influxdb state: present - update_cache: yes when: - ansible_distribution == "Archlinux"
diff --git a/roles/influxdb/tasks/main.yml b/roles/influxdb/tasks/main.yml @@ -32,7 +32,5 @@ - services.influxdb.enable is defined - services.influxdb.enable is false - - - - +- name: Run handlers + meta: flush_handlers+ \ No newline at end of file
diff --git a/roles/influxdb/tasks/nginx.yml b/roles/influxdb/tasks/nginx.yml @@ -17,17 +17,4 @@ mode: 0644 owner: nginx group: nginx - -- name: "[OpenRC] Restart service: nginx" - service: - name: nginx - state: restarted - when: - - ansible_service_mgr == "openrc" - -- name: "[systemd] Restart service: nginx" - systemd: - name: nginx - state: restarted - when: - - ansible_service_mgr == "systemd" + notify: "Restart nginx"+ \ No newline at end of file
diff --git a/roles/influxdb/tasks/remove.yml b/roles/influxdb/tasks/remove.yml @@ -30,11 +30,8 @@ when: - ansible_distribution == "Archlinux" -- name: "Delete leftovers" +- name: "Delete nginx vhost for: influxdb" file: - path: "{{item}}" + path: /etc/nginx/conf.d/influxdb.conf state: absent - with_items: - - /etc/nginx/conf.d/influxdb.conf -# - /etc/influxdb.ini -# - /var/lib/influxdb/provisioning + notify: "Restart nginx"
diff --git a/roles/influxdb/tasks/start.yml b/roles/influxdb/tasks/start.yml @@ -1,6 +1,6 @@ --- -- name: "[OpenRC] Restart and enable service: influxdb" +- name: "[OpenRC] Start and enable service: influxdb" service: name: influxdb enabled: yes @@ -8,7 +8,7 @@ when: - ansible_service_mgr == "openrc" -- name: "[systemd] Restart and enable service: influxdb" +- name: "[systemd] Start and enable service: influxdb" systemd: name: influxdb enabled: yes