diff --git a/handlers/main.yml b/handlers/main.yml index d155d79..4b0e0bc 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -19,6 +19,14 @@ throttle: 1 when: deploy_adguard_start_service +- name: "Register/Update consul service" + ansible.builtin.command: "consul services register {{ deploy_adguard_directory }}/adguard.consul.json" + environment: + CONSUL_HTTP_ADDR: "{{ deploy_adguard_consul['consul_addr'] }}" + CONSUL_HTTP_TOKEN: "{{ deploy_adguard_consul['consul_token'] }}" + changed_when: false + listen: "consul-services-register-adguard" + - name: "Enable adguard-connect-proxy service" ansible.builtin.service: name: adguard-connect-proxy diff --git a/tasks/configure.yml b/tasks/configure.yml index af28979..c5e132f 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -27,6 +27,9 @@ ansible.builtin.copy: dest: "{{ deploy_adguard_directory }}/password" content: "{{ deploy_adguard_node_exporter['password'] }}" + owner: root + group: root + mode: '0600' when: deploy_adguard_node_exporter['enable'] notify: - systemctl-restart-adguard diff --git a/tasks/consul_service.yml b/tasks/consul_service.yml index bd205c1..ad160cc 100644 --- a/tasks/consul_service.yml +++ b/tasks/consul_service.yml @@ -7,14 +7,8 @@ owner: root group: root mode: '0644' - register: _copy_service_template - -- name: "Register/Update consul service" - ansible.builtin.command: "consul services register {{ deploy_adguard_directory }}/adguard.consul.json" - environment: - CONSUL_HTTP_ADDR: "{{ deploy_adguard_consul['consul_addr'] }}" - CONSUL_HTTP_TOKEN: "{{ deploy_adguard_consul['consul_token'] }}" - when: _copy_service_template.changed + notify: + - "consul-services-register-adguard" - name: "Configure service mesh proxy" when: deploy_adguard_consul['configuration']['service']['connect'] is defined