You've already forked linux_ws2122_ansible
Initial Commit
This commit is contained in:
36
roles/bind_dhcp/tasks/bind9.yaml
Normal file
36
roles/bind_dhcp/tasks/bind9.yaml
Normal file
@ -0,0 +1,36 @@
|
||||
---
|
||||
|
||||
- name: create dhcp config dir
|
||||
file:
|
||||
path: /etc/named
|
||||
owner: named
|
||||
group: named
|
||||
mode: 0755
|
||||
state: directory
|
||||
|
||||
- name: set up zones
|
||||
template:
|
||||
src: zone.j2
|
||||
dest: /etc/named/{{ item.origin }}db
|
||||
owner: named
|
||||
group: named
|
||||
mode: 0644
|
||||
with_items:
|
||||
- "{{ bind9_forward_zones }}"
|
||||
- "{{ bind9_reverse_zones }}"
|
||||
notify: restart named
|
||||
|
||||
- name: set up global bind config
|
||||
template:
|
||||
src: named.conf.j2
|
||||
dest: /etc/named.conf
|
||||
owner: named
|
||||
group: named
|
||||
mode: 0644
|
||||
notify: restart named
|
||||
|
||||
- name: start and enabled named
|
||||
systemd:
|
||||
name: named
|
||||
state: started
|
||||
enabled: yes
|
53
roles/bind_dhcp/tasks/dhcpd.yaml
Normal file
53
roles/bind_dhcp/tasks/dhcpd.yaml
Normal file
@ -0,0 +1,53 @@
|
||||
---
|
||||
|
||||
- name: create dhcp config dir
|
||||
file:
|
||||
path: /etc/dhcp
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
state: directory
|
||||
|
||||
- name: create dhcpd config
|
||||
template:
|
||||
src: dhcpd.conf.j2
|
||||
dest: /etc/dhcp/dhcpd.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
|
||||
- name: cleanup cache files
|
||||
block:
|
||||
- name: check if cache dir exists
|
||||
stat:
|
||||
path: /var/lib/dhcpd
|
||||
register: cache_stats
|
||||
- name: remove cache dir
|
||||
file:
|
||||
path: /var/lib/dhcpd/
|
||||
state: absent
|
||||
when: cache_stats.stat.exists
|
||||
- name: create cache dir
|
||||
file:
|
||||
path: /var/lib/dhcpd/
|
||||
owner: dhcpd
|
||||
group: dhcpd
|
||||
mode: 0755
|
||||
state: directory
|
||||
- name: create cache files
|
||||
file:
|
||||
path: "/var/lib/dhcpd/{{ item }}"
|
||||
owner: dhcpd
|
||||
group: dhcpd
|
||||
mode: 0644
|
||||
state: touch
|
||||
with_items:
|
||||
- dhcpd.leases
|
||||
- dhcpd6.leases
|
||||
notify: restart dhcpd
|
||||
|
||||
- name: start and enable dhcpd
|
||||
systemd:
|
||||
name: dhcpd
|
||||
state: started
|
||||
enabled: yes
|
15
roles/bind_dhcp/tasks/main.yaml
Normal file
15
roles/bind_dhcp/tasks/main.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
|
||||
- name: install bind (named) and dependencies
|
||||
yum:
|
||||
name: "{{ item }}"
|
||||
with_items:
|
||||
- bind
|
||||
- bind-utils
|
||||
- dhcp-server
|
||||
|
||||
- name: configure dhcpd server
|
||||
include_tasks: dhcpd.yaml
|
||||
|
||||
- name: configure bind9 server
|
||||
include_tasks: bind9.yaml
|
Reference in New Issue
Block a user