Oefenweb.dnsmasq
dnsmasq
Install and configure Dnsmasq on Debian-like systems.
Requirements
No special requirements.
Variables
dnsmasq_service_state: [default:started]: Status of the service (e.g.stopped).dnsmasq_service_enabled: [default:true]: Should the service start automatically when the system boots.dnsmasq_service_resolved_disabled: [default:false]: Should thesystemd-resolvedservice be turned off?dnsmasq_etc_default_domain_suffix: [optional]: Defines the allowed domain for DHCP leases (e.g.dnsdomainname).dnsmasq_etc_default_dnsmasq_opts: [optional]: Extra options for thednsmasqservice (e.g.--conf-file=/etc/dnsmasq.alt).dnsmasq_etc_default_config_dir: [default:/etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new]: Directory to search for configuration files (leave empty to disable this).dnsmasq_etc_default_ignore_resolvconf: [optional]: Ifresolvconfis installed,dnsmasqwill use its output instead of/etc/resolv.conffor upstream nameservers (e.g.true).dnsmasq_etc_default: [see:defaults/main.yml]: Lines to add to/etc/default/dnsmasq.dnsmasq_dnsmasq_conf: [default:[]]: Lines to add to/etc/dnsmasq.conf.dnsmasq_dnsmasq_d_files_present: [default:{}]: List of configuration files to add.dnsmasq_dnsmasq_d_files_present.key: [required]: Name of the configuration file (e.g.hosts).dnsmasq_dnsmasq_d_files_present.key.{n}: [default:[]]: Lines for the configuration file.dnsmasq_dnsmasq_d_files_absent: [default:{}]: Specific configuration files to remove.dnsmasq_dnsmasq_d_files_absent.key: [required]: Name of the configuration file (e.g.hosts).
Dependencies
No dependencies.
Example
---
- hosts: all
roles:
- oefenweb.dnsmasq
Example with configuration (mapping domain to an IP address)
---
- hosts: all
roles:
- oefenweb.dnsmasq
vars:
dnsmasq_dnsmasq_d_files_present:
example-com:
- address=/mail.example.com/192.168.0.8
- address=/www.example.com/192.168.0.9
Example with configuration (caching)
---
- hosts: all
pre_tasks:
- name: create resolv-file for dnsmasq
ansible.builtin.copy:
content: |
nameserver 8.8.8.8
nameserver 8.8.4.4
dest: /etc/resolv.dnsmasq
roles:
- oefenweb.dnsmasq
vars:
dnsmasq_dnsmasq_conf:
- |
port=53
listen-address={{ ansible_lo['ipv4']['address'] }}
bind-interfaces
dnsmasq_dnsmasq_d_files_present:
cache:
- |
domain-needed
bogus-priv
no-hosts
dns-forward-max=150
cache-size=1000
neg-ttl=3600
resolv-file=/etc/resolv.dnsmasq
no-poll
License
MIT License.
Author Information
- Mark van Driel
- Mischa ter Smitten
Feedback, bug reports, requests, ...
Your feedback is welcome!
ansible-galaxy install Oefenweb.dnsmasq