ADD import roles

This commit is contained in:
2024-09-15 09:42:20 +02:00
parent 4798dde38c
commit e6027e9078
36 changed files with 1129 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
isc_dhcp_enabled: false
+6
View File
@@ -0,0 +1,6 @@
---
- name: Restart isc_dhcp
ansible.builtin.systemd_service:
name: isc-dhcp-server.service
state: restarted
enabled: true
+64
View File
@@ -0,0 +1,64 @@
---
- name: Set OS dependent variables
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_distribution | lower }}_{{ ansible_distribution_version | lower }}.yml"
- "{{ ansible_distribution | lower }}_{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_os_family | lower }}.yml"
- "{{ ansible_system | lower }}.yml"
paths:
- "{{ role_path }}/vars"
ignore_errors: True
tags:
- always
- name: OS is supported
assert:
that: __os_supported
quiet: True
vars:
__os_supported: "{{ lookup('vars', '{}_os_supported'.format(role_name)) | bool }}"
tags:
- always
- name: Install required packages
package:
name: "{{ item }}"
state: present
with_items: "{{ lookup('vars', '{}_packages'.format(role_name)) | list }}"
when: radvd_enabled
tags:
- install
- name: Install dhcpd configuration
template:
src: dhcpd.conf.j2
dest: "/etc/dhcp/dhcpd.conf"
owner: root
group: root
mode: 0644
tags:
- configure
no_log: false
notify: Restart isc_dhcp
- name: Install dhcpd configuration
template:
src: isc-dhcp-server.j2
dest: "/etc/default/isc-dhcp-server"
owner: root
group: root
mode: 0644
tags:
- configure
no_log: false
notify: Restart isc_dhcp
- name: Enable dhcpd service
ansible.builtin.systemd_service:
name: isc-dhcp-server.service
state: started
enabled: true
+21
View File
@@ -0,0 +1,21 @@
# {{ ansible_managed }}
ddns-update-style none;
authoritative;
{% for net in isc_dhcp_networks | default([]) %}
# {{ net.interface }}
subnet {{ net.subnet }} netmask {{ net.netmask }} {
interface {{ net.interface }};
option routers {{ net.router }};
option subnet-mask {{ net.netmask }};
{% if net.dns is defined %}
option domain-name-servers {{ net.dns }};
{% endif %}
option domain-name "{{ net.domain | default('hiwi.net.scc.kit.edu') }}";
range {{ net.range_start }} {{ net.range_end }};
default-lease-time 600;
max-lease-time 7200;
}
{% endfor %}
@@ -0,0 +1,2 @@
# {{ ansible_managed }}
INTERFACESv4="{{ isc_dhcp_networks | map(attribute='interface') | join(' ') }}"
+3
View File
@@ -0,0 +1,3 @@
isc_dhcp_os_supported: true
isc_dhcp_packages:
- isc-dhcp-server
+1
View File
@@ -0,0 +1 @@
isc_dhcp_os_supported: false