diff --git a/roles/dnsmasq/defaults/main.yml b/roles/dnsmasq/defaults/main.yml index 0788c90..24e3d56 100644 --- a/roles/dnsmasq/defaults/main.yml +++ b/roles/dnsmasq/defaults/main.yml @@ -1,3 +1,3 @@ --- -cache_size: 100 -dns_port: 5300 +dnsmasq_cache_size: 100 +dnsmasq_dns_port: 5300 diff --git a/roles/dnsmasq/meta/main.yml b/roles/dnsmasq/meta/main.yml index 414d68d..03ddef7 100644 --- a/roles/dnsmasq/meta/main.yml +++ b/roles/dnsmasq/meta/main.yml @@ -10,8 +10,8 @@ galaxy_info: platforms: - name: "Ubuntu" - versions: [ "focal", "jammy" ] + versions: ["focal", "jammy"] - galaxy_tags: [ ] + galaxy_tags: [] dependencies: [] diff --git a/roles/dnsmasq/molecule/default/converge.yml b/roles/dnsmasq/molecule/default/converge.yml index f41738d..6a8f31d 100644 --- a/roles/dnsmasq/molecule/default/converge.yml +++ b/roles/dnsmasq/molecule/default/converge.yml @@ -2,7 +2,7 @@ - name: Converge hosts: all roles: - - role: genlab.ufw + - role: genlab.common.ufw disable_ipv6: true rules: - rule: allow @@ -12,10 +12,10 @@ direction: in comment: "Allow dnsmasq to serve DNS queries on the given interface" - - role: genlab.dnsmasq - iface: lo - domain: adm.local - dns_port: 5300 - nodes: + - role: genlab.common.dnsmasq + dnsmasq_iface: lo + dnsmasq_domain: adm.local + dnsmasq_dns_port: 5300 + dnsmasq_nodes: - name: hub ip: 127.0.0.1 diff --git a/roles/dnsmasq/molecule/default/verify.yml b/roles/dnsmasq/molecule/default/verify.yml index 3a4ca5f..8eaf15a 100644 --- a/roles/dnsmasq/molecule/default/verify.yml +++ b/roles/dnsmasq/molecule/default/verify.yml @@ -13,7 +13,7 @@ tasks: - name: "Test the output of the `dig` command" changed_when: false - register: dig + register: dnsmasq_dig failed_when: 'dig.stdout != "127.0.0.1"' ansible.builtin.command: cmd: "dig @127.0.0.1 -p 5353 hub.adm.vpn +short" diff --git a/roles/dnsmasq/tasks/main.yml b/roles/dnsmasq/tasks/main.yml index 6f7d0ec..ff29987 100644 --- a/roles/dnsmasq/tasks/main.yml +++ b/roles/dnsmasq/tasks/main.yml @@ -9,29 +9,29 @@ - name: "Create interface-specific configuration file" notify: "Restart dnsmasq" ansible.builtin.blockinfile: - path: /etc/dnsmasq.d/{{ domain }}.conf + path: /etc/dnsmasq.d/{{ dnsmasq_domain }}.conf create: true owner: root group: root mode: "0660" block: | - interface="{{ iface }}" - port="{{ dns_port }}" - cache-size="{{ cache_size }}" + interface="{{ dnsmasq_iface }}" + port="{{ dnsmasq_dns_port }}" + cache-size="{{ dnsmasq_cache_size }}" log-queries server=1.1.1.1 # Cloudflare DNS server=8.8.8.8 # Google DNS server=8.8.4.4 # Google DNS (secondary) -- name: "Add nodes to the configuration file" +- name: "Add dnsmasq_nodes to the configuration file" notify: "Restart dnsmasq" - loop: "{{ nodes }}" + loop: "{{ dnsmasq_nodes }}" ansible.builtin.blockinfile: - path: /etc/dnsmasq.d/{{ domain }}.conf - marker: "# {mark} ANSIBLE MANAGED: {{ item.name }}.{{ domain }}" + path: /etc/dnsmasq.d/{{ dnsmasq_domain }}.conf + marker: "# {mark} ANSIBLE MANAGED: {{ item.name }}.{{ dnsmasq_domain }}" block: | - address=/{{ item.name }}.{{ domain }}/{{ item.ip }} + address=/{{ item.name }}.{{ dnsmasq_domain }}/{{ item.ip }} - name: "Flush handlers"