dnsmasq module
This commit is contained in:
parent
99a6387d8b
commit
43133af080
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
|
||||
- name: install dnsmasq
|
||||
apt:
|
||||
name: dnsmasq
|
||||
|
||||
|
||||
- name: Generate /etc/hosts file
|
||||
template:
|
||||
src: hosts.j2
|
||||
dest: /etc/hosts
|
||||
|
||||
- name: listen on all interfaces
|
||||
lineinfile:
|
||||
dest: /etc/dnsmasq.conf
|
||||
regexp: listen-address=
|
||||
line: listen-address=127.0.0.1,{{ ansible_default_ipv4.address }}
|
||||
state: present
|
|
@ -0,0 +1,17 @@
|
|||
# {{ ansible_managed }}
|
||||
127.0.0.1 localhost
|
||||
::1 localhost ip6-localhost ip6-loopback
|
||||
|
||||
# The following lines are desirable for IPv6 capable hosts.
|
||||
fe00::0 ip6-localnet
|
||||
ff00::0 ip6-mcastprefix
|
||||
ff02::1 ip6-allnodes
|
||||
ff02::2 ip6-allrouters
|
||||
|
||||
# Network nodes as generated through Ansible.
|
||||
{% for host in groups.all %}
|
||||
{% set short_name = host.split('.') %}
|
||||
{% if 'ansible_default_ipv4' in hostvars[host] %}
|
||||
{{ hostvars[host].ansible_default_ipv4.address }} {{host}} {{ short_name[0] }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
Loading…
Reference in New Issue