feat: Define variables for directories
This commit is contained in:
parent
ae9e8695bf
commit
410825770b
@ -1,6 +1,13 @@
|
||||
---
|
||||
# defaults file for dnsmasq
|
||||
|
||||
# Directory to deploy configuration
|
||||
dnsmasq_conf_directory: /etc/dnsmasq.d
|
||||
|
||||
# Directory to deploy records files
|
||||
dnsmasq_records_directory: "{{ dnsmasq_conf_directory }}/records"
|
||||
|
||||
# Configuration
|
||||
dnsmasq_domain: ""
|
||||
dnsmasq_servers: []
|
||||
dnsmasq_rev_servers: []
|
||||
@ -15,11 +22,11 @@ dnsmasq_host_aliases: []
|
||||
dnsmasq_client_filename: "{{ inventory_hostname }}"
|
||||
dnsmasq_client_hostname: "{{ inventory_hostname }} {{ inventory_hostname_short }}"
|
||||
|
||||
# Groupe ansible pour l'enregistrement automatique
|
||||
# Ansible group automatically used in records file
|
||||
dnsmasq_ansible_group: ""
|
||||
|
||||
# CIDR du sous-réseau IPv6
|
||||
# IPv6 subnet
|
||||
dnsmasq_ipv6_subnet: ""
|
||||
|
||||
# Enregistrement spécifiques
|
||||
# Specific records
|
||||
dnsmasq_specifics: []
|
||||
|
@ -9,18 +9,18 @@
|
||||
become: true
|
||||
|
||||
- name: Reload dnsmasq.service
|
||||
ansible.builtin.systemd:
|
||||
ansible.builtin.systemd_service:
|
||||
name: dnsmasq.service
|
||||
state: reloaded
|
||||
become: true
|
||||
register: dnsmasq_reload
|
||||
|
||||
- name: Reload dnsmasq.service on dns servers
|
||||
become: true
|
||||
ansible.builtin.systemd:
|
||||
ansible.builtin.systemd_service:
|
||||
state: reloaded
|
||||
name: dnsmasq.service
|
||||
when: dnsmasq_reload is undefined
|
||||
become: true
|
||||
loop: "{{ dnsmasq_hosts }}"
|
||||
delegate_to: "{{ item }}"
|
||||
run_once: true
|
||||
|
@ -1,9 +1,9 @@
|
||||
---
|
||||
# tasks file for security
|
||||
# tasks file for dnsmasq
|
||||
|
||||
- name: Create records directory
|
||||
ansible.builtin.file:
|
||||
path: /srv/dnsmasq
|
||||
path: "{{ dnsmasq_records_directory }}"
|
||||
state: directory
|
||||
owner: dnsmasq
|
||||
group: root
|
||||
@ -12,14 +12,14 @@
|
||||
|
||||
- name: Remove old configuration
|
||||
ansible.builtin.file:
|
||||
path: /etc/dnsmasq.d/cache.conf
|
||||
path: "{{ dnsmasq_conf_directory }}/cache.conf"
|
||||
state: absent
|
||||
become: true
|
||||
|
||||
- name: Deploy configuration
|
||||
ansible.builtin.template:
|
||||
src: dnsmasq.conf.j2
|
||||
dest: /etc/dnsmasq.d/dns.conf
|
||||
dest: "{{ dnsmasq_conf_directory }}/etc/dnsmasq.d/dns.conf"
|
||||
owner: root
|
||||
group: root
|
||||
mode: u=rw,g=r,o=r
|
||||
@ -29,7 +29,7 @@
|
||||
- name: Deploy specific records
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/records_specific.conf.j2"
|
||||
dest: /srv/dnsmasq/specific.conf
|
||||
dest: "{{ dnsmasq_records_directory }}/specific.conf"
|
||||
owner: dnsmasq
|
||||
group: root
|
||||
mode: u=rw,g=r,o=r
|
||||
|
@ -1,16 +0,0 @@
|
||||
---
|
||||
# tasks file for dnsmasq
|
||||
|
||||
- name: Installer dnsmasq
|
||||
become: true
|
||||
ansible.builtin.package:
|
||||
name: dnsmasq
|
||||
|
||||
- name: Créer le dossier dédié à dnsmasq
|
||||
ansible.builtin.file:
|
||||
path: /srv/dnsmasq
|
||||
state: directory
|
||||
owner: dnsmasq
|
||||
group: root
|
||||
mode: u=rwX,g=rX,o=rX
|
||||
become: true
|
@ -1,7 +1,13 @@
|
||||
---
|
||||
# tasks file for dnsmasq
|
||||
|
||||
- name: Install stubby
|
||||
- name: Install dnsmasq
|
||||
ansible.builtin.package:
|
||||
name: dnsmasq
|
||||
when: ansible_facts['pkg_mgr'] == "apt"
|
||||
become: true
|
||||
|
||||
- name: Install dnsmasq
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- /usr/bin/rpm-ostree
|
||||
@ -11,8 +17,16 @@
|
||||
- --idempotent
|
||||
- dnsmasq
|
||||
creates: /sysroot/ostree/repo/refs/heads/rpmostree/pkg/dnsmasq
|
||||
when: ansible_facts['pkg_mgr'] == "atomic_container"
|
||||
become: true
|
||||
notify: Apply installation
|
||||
|
||||
- name: Flush handlers
|
||||
meta: flush_handlers
|
||||
|
||||
- name: Enable dnsmasq.service
|
||||
ansible.builtin.systemd_service:
|
||||
name: dnsmasq.service
|
||||
masked: false
|
||||
enabled: true
|
||||
become: true
|
@ -3,7 +3,7 @@
|
||||
|
||||
- name: Include installation tasks
|
||||
ansible.builtin.include_tasks:
|
||||
file: installation-{{ ansible_facts['pkg_mgr'] }}.yml
|
||||
file: installation.yml
|
||||
|
||||
- name: Import configuration tasks
|
||||
ansible.builtin.import_tasks:
|
||||
|
@ -1,10 +1,10 @@
|
||||
---
|
||||
# tasks file for security
|
||||
|
||||
- name: Deploy records from ansible inventory
|
||||
- name: Deploy records from ansible group
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/records_auto.conf.j2"
|
||||
dest: /srv/dnsmasq/auto-{{ dnsmasq_ansible_group }}.conf
|
||||
dest: "{{ dnsmasq_records_directory }}/auto-{{ dnsmasq_ansible_group }}.conf"
|
||||
owner: dnsmasq
|
||||
group: root
|
||||
mode: u=rw,g=r,o=r
|
||||
|
@ -1,8 +1,5 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
# Répondre aux demandes locales uniquement
|
||||
local-service
|
||||
|
||||
# Ne pas transmettre les requêtes avec un nom court (pas FQDN)
|
||||
domain-needed
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user