role_dnsmasq/tasks/client.yml

32 lines
882 B
YAML
Raw Normal View History

2022-10-03 15:20:34 +00:00
---
# tasks file for security
- name: Déployer le fichier lié à l'hôte
ansible.builtin.template:
owner: dnsmasq
group: root
mode: u=rw,g=r,o=r
src: "{{ role_path }}/templates/host.conf.j2"
dest: /srv/dnsmasq/{{ dnsmasq_client_filename }}.conf
when: dnsmasq_servers | length > 0
tags: creation
loop: "{{ dnsmasq_servers }}"
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_servers | length > 0
tags: [destruction, never]
loop: "{{ dnsmasq_servers }}"
loop_control:
loop_var: dnsserver
delegate_to: "{{ dnsserver }}"
become: true
notify: Recharger dnsmasq.service sur les serveurs