Initial Commit

This commit is contained in:
2021-12-11 22:46:32 +01:00
commit 8354baa32f
47 changed files with 1283 additions and 0 deletions

View 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

View 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

View 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