dnsmasq

dnsmasq

CI Ansible Galaxy

Set up Dnsmasq in Debian-like systems.

Requirements

None

Variables

  • dnsmasq_service_state: [default: started]: The state of th service (e.g. stopped)

  • dnsmasq_service_enabled: [default: true]: Whether the service should start on boot

  • dnsmasq_service_resolved_disabled: [default: false]: Whether the service systemd-resolved should be disabled

  • dnsmasq_etc_default_domain_suffix: [optional]: Specifies the domain which hosts read from the DHCP leases file must have to be legal (e.g. dnsdomainname)

  • dnsmasq_etc_default_dnsmasq_opts: [optional]: Options to pass to the dnsmasq daemon (e.g. --conf-file=/etc/dnsmasq.alt)

  • dnsmasq_etc_default_config_dir: [default: /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new]: Searches this drop directory for configuration options (leave empty to comment out)

  • dnsmasq_etc_default_ignore_resolvconf: [optional]: If the resolvconf package is installed, dnsmasq will use its output rather than the contents of /etc/resolv.conf to find upstream nameservers (e.g. true)

  • dnsmasq_etc_default: [see: defaults/main.yml]: List of lines to be added to /etc/default/dnsmasq

  • dnsmasq_dnsmasq_conf: [default: []]: List of lines to be added to /etc/dnsmasq.conf

  • dnsmasq_dnsmasq_d_files_present: [default: {}]: Declaration of specific configuration files (to add)

  • dnsmasq_dnsmasq_d_files_present.key: [required]: The name of the configuration file (e.g. hosts)

  • dnsmasq_dnsmasq_d_files_present.key.{n}: [default: []]: List of lines of the configuration file

  • dnsmasq_dnsmasq_d_files_absent: [default: {}]: Specific configuration files to remove

  • dnsmasq_dnsmasq_d_files_absent.key: [required]: The name of the configuration file (e.g. hosts)

Dependencies

None

Example

---
- hosts: all
  roles:
    - oefenweb.dnsmasq

Example with configuration (force 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

Author Information

  • Mark van Driel
  • Mischa ter Smitten

Feedback, bug-reports, requests, ...

Are welcome!

About

Set up dnsmasq in Debian-like systems

Install
ansible-galaxy install Oefenweb/ansible-dnsmasq
GitHub repository
License
mit
Downloads
347386