From 89a1ba95cd1dc22e177eda1b3f02c59156977465 Mon Sep 17 00:00:00 2001 From: "pulsar89.5" Date: Tue, 14 May 2024 11:47:09 +0200 Subject: [PATCH] feat: Simplify configuration --- tasks/client.yml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tasks/client.yml b/tasks/client.yml index 1eac074..b9d1620 100644 --- a/tasks/client.yml +++ b/tasks/client.yml @@ -8,27 +8,23 @@ mode: u=rw,g=r,o=r src: "{{ role_path }}/templates/host.conf.j2" dest: /srv/dnsmasq/{{ dnsmasq_client_filename }}.conf - when: - - dnsmasq_hosts | length > 0 - - dnsmasq_host_ipv4 not in dnsmasq_hosts + when: dnsmasq_hosts | length > 0 + become: true + delegate_to: "{{ dnsserver }}" loop: "{{ dnsmasq_hosts }}" loop_control: loop_var: dnsserver - delegate_to: "{{ dnsserver }}" - become: true notify: Recharger dnsmasq.service sur les serveurs - name: Supprimer le fichier lié à l'hôte ansible.builtin.file: path: /srv/dnsmasq/{{ dnsmasq_client_filename }}.conf state: absent - when: - - dnsmasq_hosts | length > 0 - - dnsmasq_host_ipv4 not in dnsmasq_hosts + when: dnsmasq_hosts | length > 0 tags: [destruction, never] + become: true + delegate_to: "{{ dnsserver }}" loop: "{{ dnsmasq_hosts }}" loop_control: loop_var: dnsserver - delegate_to: "{{ dnsserver }}" - become: true notify: Recharger dnsmasq.service sur les serveurs