forked from debops/ansible-dhcpd
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Anthony25-use_package'
- Loading branch information
Showing
12 changed files
with
183 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
--- | ||
|
||
- name: Restart isc-dhcp-server | ||
- name: Restart dhcp server | ||
service: | ||
name: 'isc-dhcp-server' | ||
name: '{{ item }}' | ||
state: 'restarted' | ||
with_items: "{{ dhcpd_services.server }}" | ||
|
||
- name: Restart isc-dhcp-relay | ||
- name: Restart dhcp relay | ||
service: | ||
name: 'isc-dhcp-relay' | ||
name: '{{ item }}' | ||
state: 'restarted' | ||
with_items: "{{ dhcpd_services.relay }}" | ||
|
||
- name: Restart dhcp-probe | ||
- name: Restart dhcp probe | ||
service: | ||
name: 'dhcp-probe' | ||
name: '{{ item }}' | ||
state: 'stopped' | ||
notify: [ 'Start dhcp-probe' ] | ||
with_items: "{{ dhcpd_services.probe }}" | ||
notify: [ 'Start dhcp probe' ] | ||
|
||
- name: Start dhcp-probe | ||
- name: Start dhcp probe | ||
service: | ||
name: 'dhcp-probe' | ||
name: '{{ item }}' | ||
state: 'started' | ||
with_items: "{{ dhcpd_services.probe }}" | ||
|
||
# vim: set ts=2 sw=2: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
|
||
- name: Include distribution specific variables | ||
include_vars: | ||
file: "{{ item }}" | ||
name: _os_specific | ||
with_first_found: | ||
- "{{ ansible_distribution_release }}.yml" | ||
- "{{ ansible_distribution }}.yml" | ||
- "{{ ansible_os_family }}.yml" | ||
- "default.yml" | ||
|
||
- name: Set OS specific vars if undefined | ||
set_fact: { | ||
"{{ item.key }}": | ||
"{{ hostvars[inventory_hostname][item.key] | default(item.value) }}" | ||
} | ||
with_dict: "{{ _os_specific }}" | ||
|
||
# vim: set ts=2 sw=2: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
|
||
- name: Configure DHCP relay in debconf | ||
debconf: | ||
name: 'isc-dhcp-relay' | ||
question: 'isc-dhcp-relay/{{ item.key }}' | ||
vtype: 'string' | ||
value: '{{ item.value }}' | ||
with_dict: | ||
servers: '{{ dhcpd_relay_servers | join(" ") }}' | ||
interfaces: '{{ dhcpd_relay_interfaces | join(" ") }}' | ||
options: '{{ dhcpd_relay_options }}' | ||
register: dhcpd_register_relay_debconf | ||
when: | ||
- ansible_os_family == "Debian" | ||
- dhcpd_mode == 'relay' | ||
|
||
- name: Install DHCP packages | ||
package: | ||
name: '{{ item }}' | ||
state: 'present' | ||
with_flattened: | ||
- '{{ dhcpd_base_packages_map[dhcpd_mode] }}' | ||
- '{{ dhcpd_base_packages_map["probe"] }}' | ||
|
||
- name: Reconfigure ISC DHCP relay | ||
command: dpkg-reconfigure --frontend=noninteractive isc-dhcp-relay | ||
notify: [ 'Restart dhcp relay' ] | ||
when: | ||
- ansible_os_family == "Debian" | ||
- dhcpd_register_relay_debconf|d() and dhcpd_register_relay_debconf.changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
|
||
dhcpd_base_packages_map: | ||
'server': | ||
- 'dhcp' | ||
'relay': | ||
- 'dhcp' | ||
'probe': | ||
- 'dhcp-probe' | ||
|
||
dhcpd_services: | ||
'server': | ||
- 'dhcpd' | ||
'relay': | ||
- 'dhcpd' | ||
'probe': | ||
- 'dhcp-probe' | ||
|
||
dhcpd_templates: | ||
- 'etc/dhcp/dhcpd.conf' | ||
|
||
# vim: set ts=2 sw=2: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
|
||
dhcpd_base_packages_map: | ||
'server': | ||
- 'dhcp' | ||
'relay': | ||
- 'dhcp' | ||
'probe': [] | ||
|
||
dhcpd_services: | ||
'server': | ||
- 'dhcpd4' | ||
- 'dhcpd6' | ||
'relay': | ||
- 'dhcpd4' | ||
- 'dhcpd6' | ||
'probe': [] | ||
|
||
dhcpd_templates: | ||
- 'etc/dhcp/dhcpd.conf' | ||
|
||
# vim: set ts=2 sw=2: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
|
||
dhcpd_base_packages_map: | ||
'server': | ||
- 'isc-dhcp-server' | ||
'relay': | ||
- 'isc-dhcp-relay' | ||
'probe': [] | ||
|
||
dhcpd_services: | ||
'server': | ||
- 'isc-dhcp-server' | ||
'relay': | ||
- 'isc-dhcp-relay' | ||
'probe': | ||
- 'dhcp-probe' | ||
|
||
dhcpd_templates: | ||
- 'etc/default/isc-dhcp-server' | ||
- 'etc/dhcp/dhcpd.conf' | ||
|
||
# vim: set ts=2 sw=2: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
|
||
dhcpd_base_packages_map: | ||
'server': | ||
- 'dhcp' | ||
'relay': | ||
- 'dhcp' | ||
'probe': [] | ||
|
||
dhcpd_services: | ||
'server': | ||
- 'dhcpd' | ||
'relay': | ||
- 'dhcpd' | ||
'probe': [] | ||
|
||
dhcpd_templates: | ||
- 'etc/dhcp/dhcpd.conf' | ||
|
||
# vim: set ts=2 sw=2: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
|
||
dhcpd_base_packages_map: | ||
'server': | ||
- 'dhcp' | ||
'relay': | ||
- 'dhcp' | ||
'probe': [] | ||
|
||
dhcpd_services: | ||
'server': | ||
- 'dhcpd4' | ||
- 'dhcpd6' | ||
'relay': | ||
- 'dhcpd4' | ||
- 'dhcpd6' | ||
'probe': [] | ||
|
||
dhcpd_templates: | ||
- 'etc/dhcp/dhcpd.conf' | ||
|
||
# vim: set ts=2 sw=2: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
|
||
# vim: set ts=2 sw=2: |