All my Ansible Playbooks
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

36 lines
1.2 KiB

---
- name: Install dnsmasq
yum: name=dnsmasq state=installed
when: "'admin' in group_names" # Only on admin server
tags: rpm
- name: Set dnsmasq config
template: src=dnsmasq.conf dest=/etc/dnsmasq.conf
when: "'admin' in group_names" # Only on admin server
tags: config
- name: Generate an /etc/hosts with all hosts
template: dest=/etc/hosts.dnsmasq src=hosts
when: "'admin' in group_names" # Only on admin server
tags: config
- name: Make sure dnsmasq daemon is enabled and started
service: name=dnsmasq state=started enabled=yes
when: "'admin' in group_names" # Only on admin server
tags: config
- name: Add an iptable rule to allow DNS queries from other hosts
lineinfile: dest=/etc/sysconfig/iptables line="-A INPUT -p udp --dport 53 -j ACCEPT" insertafter="-A INPUT -i lo -j ACCEPT"
when: "'admin' in group_names" # Only on admin server
tags: iptables
- name: Restart iptables
service: name=iptables enabled=yes state=restarted
when: "'admin' in group_names" # Only on admin server
tags: iptables
- name: Fix the /etc/resolv.conf of other hosts
template: dest=/etc/resolv.conf src=resolv.conf
when: "'admin' not in group_names" # On all other nodes
tags: config