Skip to content

Commit

Permalink
Added beginning of Ubuntu support
Browse files Browse the repository at this point in the history
Signed-off-by: Larry Smith Jr <mrlesmithjr@gmail.coml>
  • Loading branch information
Larry Smith Jr committed May 17, 2016
1 parent b612433 commit 082c1c4
Show file tree
Hide file tree
Showing 10 changed files with 282 additions and 27 deletions.
14 changes: 12 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
---
# defaults file for ansible-kea-dhcp
kea_dhcp_debian_packages:
- 'kea-dhcp-ddns-server'
- 'kea-dhcp4-server'
# - 'kea-dhcp6-server'
kea_dhcp_debian_services:
- name: 'kea-dhcp-ddns-server'
enabled: true
- name: 'kea-dhcp4-server'
enabled: true
- name: 'kea-dhcp6-server'
enabled: false
kea_dhcp_configs:
- name: 'Dhcp4'
backend: 'memfile'
Expand Down Expand Up @@ -51,8 +62,7 @@ kea_dhcp_configs:
subnet: '192.0.4.0/24'
valid_lifetime: 4000
kea_dhcp_ddns_configs:

kea_dhcp_services: #Defines services to enable
kea_dhcp_redhat_services: #Defines services to enable
- name: 'kea-dhcp-ddns'
enabled: true
- name: 'kea-dhcp4'
Expand Down
17 changes: 14 additions & 3 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
---
# handlers file for ansible-kea-dhcp
- name: "restart kea-dhcp"
- name: "restart redhat kea-dhcp"
service:
name: "{{ item.name }}"
state: "restarted"
with_items: '{{ kea_dhcp_services }}'
when: item.enabled
with_items: '{{ kea_dhcp_redhat_services }}'
when: >
ansible_os_family == "RedHat" and
item.enabled
- name: "restart debian kea-dhcp"
service:
name: "{{ item.name }}"
state: "restarted"
with_items: '{{ kea_dhcp_debian_services }}'
when: >
ansible_os_family == "Debian" and
item.enabled
28 changes: 14 additions & 14 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
galaxy_info:
author: your name
description:
description:
company: your company (optional)

# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker

# Some suggested licenses:
# - BSD (default)
# - MIT
Expand All @@ -15,7 +15,7 @@ galaxy_info:
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)

min_ansible_version: 1.2

# Optionally specify the branch Galaxy will use when accessing the GitHub
Expand All @@ -25,19 +25,19 @@ galaxy_info:
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:

#
# Below are all platforms currently available. Just uncomment
# the ones that apply to your role. If you don't see your
# platform on this list, let us know and we'll get it added!
#
#platforms:
#- name: EL
# versions:
platforms:
- name: EL
versions:
# - all
# - 5
# - 6
# - 7
- 7
#- name: GenericUNIX
# versions:
# - all
Expand Down Expand Up @@ -114,8 +114,8 @@ galaxy_info:
# - 9.1
# - 9.2
# - 9.3
#- name: Ubuntu
# versions:
- name: Ubuntu
versions:
# - all
# - lucid
# - maverick
Expand All @@ -129,7 +129,7 @@ galaxy_info:
# - utopic
# - vivid
# - wily
# - xenial
- xenial
#- name: SLES
# versions:
# - all
Expand Down Expand Up @@ -157,7 +157,7 @@ galaxy_info:
# - squeeze
# - stretch
# - wheezy

galaxy_tags: []
# List tags for your role here, one per line. A tag is
# a keyword that describes and categorizes the role.
Expand All @@ -170,4 +170,4 @@ galaxy_info:
dependencies: []
# List your role dependencies here, one per line.
# Be sure to remove the '[]' above if you add dependencies
# to this list.
# to this list.
19 changes: 17 additions & 2 deletions tasks/config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
---
- name: config | configuring kea dhcp service
- name: config | configuring kea dhcp services (RedHat)
template:
src: "etc/kea/kea.conf.j2"
dest: "/etc/kea/kea.conf"
owner: "root"
group: "root"
mode: "o=rw,g=r,o=r"
notify:
- restart kea-dhcp
- 'restart redhat kea-dhcp'
when: ansible_os_family == "RedHat"

- name: config | configuring kea dhcp services (Debian)
template:
src: "{{ item }}.j2"
dest: "/{{ item }}"
owner: "root"
group: "root"
mode: "o=rw,g=r,o=r"
notify:
- 'restart {{ ansible_os_family|lower }} kea-dhcp'
with_items:
- 'etc/kea/kea-dhcp-ddns.conf'
- 'etc/kea/kea-dhcp4.conf'
when: ansible_os_family == "Debian"
11 changes: 11 additions & 0 deletions tasks/debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: debian | updating apt-cache
apt:
update_cache: "yes"
cache_valid_time: 86400

- name: debian | installing kea packages
apt:
name: "{{ item }}"
state: "present"
with_items: '{{ kea_dhcp_debian_packages }}'
3 changes: 3 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
# tasks file for ansible-kea-dhcp
- include: debian.yml
when: ansible_os_family == "Debian"

- include: redhat.yml
when: ansible_os_family == "RedHat"

Expand Down
29 changes: 24 additions & 5 deletions tasks/services.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
---
- name: services | enabling kea services
- name: services | enabling kea services (Debian)
service:
name: "{{ item.name }}"
enabled: "{{ item.enabled }}"
with_items: '{{ kea_dhcp_services }}'
with_items: '{{ kea_dhcp_debian_services }}'
when: ansible_os_family == "Debian"

- name: services | ensuring kea services are started
- name: services | ensuring kea services are started (Debian)
service:
name: "{{ item.name }}"
state: "started"
with_items: '{{ kea_dhcp_services }}'
when: item.enabled
with_items: '{{ kea_dhcp_debian_services }}'
when: >
ansible_os_family == "Debian" and
item.enabled
- name: services | enabling kea services (RedHat)
service:
name: "{{ item.name }}"
enabled: "{{ item.enabled }}"
with_items: '{{ kea_dhcp_redhat_services }}'
when: ansible_os_family == "RedHat"

- name: services | ensuring kea services are started (RedHat)
service:
name: "{{ item.name }}"
state: "started"
with_items: '{{ kea_dhcp_redhat_services }}'
when: >
ansible_os_family == "RedHat" and
item.enabled
18 changes: 18 additions & 0 deletions templates/etc/kea/kea-dhcp-ddns.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This is a basic configuration for the Kea DHCP DDNS.
# Subnet declarations are commented out and no interfaces are listed.
# Therefore, the servers will not listen or respond to any queries.
# The basic configuration must be extended to specify interfaces on
# which the servers should listen. Also, subnets and options must be
# declared.
{

# DHCP DDNS configuration starts here.
"DhcpDdns":
{
"ip-address": "127.0.0.1",
"port": 53001,
"tsig-keys": [],
"forward-ddns" : {},
"reverse-ddns" : {}
}
}
Loading

0 comments on commit 082c1c4

Please sign in to comment.