feat: Define variables for directories

This commit is contained in:
2025-03-31 16:47:55 +02:00
parent ae9e8695bf
commit 410825770b
8 changed files with 36 additions and 34 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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:

View File

@@ -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