role_dnsmasq/tasks/configuration.yml

45 lines
1.1 KiB
YAML

---
# tasks file for security
- name: Supprimer l'ancien fichier de configuration
ansible.builtin.file:
path: /etc/dnsmasq.d/cache.conf
state: absent
become: true
- name: Configurer dnsmasq
ansible.builtin.template:
src: dnsmasq.conf.j2
dest: /etc/dnsmasq.d/dns.conf
owner: root
group: root
mode: u=rw,g=r,o=r
become: true
notify: Recharger dnsmasq.service
- name: Déployer la configuration de l'instance
ansible.builtin.template:
src: host.conf.j2
dest: /srv/dnsmasq/{{ inventory_hostname }}.conf
owner: dnsmasq
group: root
mode: u=rw,g=r,o=r
become: true
notify: Recharger dnsmasq.service
- name: Déployer les configurations specifiques
ansible.builtin.template:
src: specific.conf.j2
dest: "{{ filename }}"
owner: dnsmasq
group: root
mode: u=rw,g=r,o=r
when: dnsmasq_specifics | length > 0
become: true
notify: Recharger dnsmasq.service
loop: "{{ dnsmasq_specifics }}"
loop_control:
label: "{{ filename }}"
vars:
filename: /srv/dnsmasq/{{ item.hostname }}.conf