Update roles
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
install_date: Wed May 5 16:13:59 2021
|
||||
install_date: Wed Jun 30 01:12:45 2021
|
||||
version: 3.1.0
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
install_date: Wed May 5 16:13:58 2021
|
||||
install_date: Wed Jun 30 01:12:44 2021
|
||||
version: 1.10.0
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
install_date: Wed May 5 16:14:11 2021
|
||||
install_date: Wed Jun 30 01:12:56 2021
|
||||
version: master
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
install_date: Wed May 5 16:14:10 2021
|
||||
install_date: Wed Jun 30 01:12:54 2021
|
||||
version: 2.1.0
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
install_date: Wed May 5 16:14:13 2021
|
||||
install_date: Wed Jun 30 01:12:57 2021
|
||||
version: 1.3.0
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
install_date: Wed May 5 16:14:07 2021
|
||||
install_date: Wed Jun 30 01:12:51 2021
|
||||
version: ''
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
install_date: Wed May 5 16:14:02 2021
|
||||
install_date: Wed Jun 30 01:12:47 2021
|
||||
version: ''
|
||||
|
||||
@@ -50,8 +50,8 @@ Including an example of how to use your role (for instance, with variables passe
|
||||
export_ovf: no # export the template to export domain upon creation
|
||||
local_account_password: ''
|
||||
local_administrator_password: ''
|
||||
linux_distro_name: rhel_81 # this needs to be one of the standard values see 'os_short_names' var
|
||||
template_vm_name: rhel81-x64-v1
|
||||
distro_name: rhel8 # this needs to be one of the standard values see 'os_short_names' var
|
||||
template_vm_name: rhel84-x64-v1
|
||||
template_vm_root_disk_size: 10
|
||||
template_vm_memory: 4096
|
||||
template_vm_efi: false # you need to install efi file to use this, false should be fine in most cases
|
||||
|
||||
@@ -26,12 +26,12 @@ local_administrator_password: Chang3MyP@ssw0rd21
|
||||
local_account_username: ansible
|
||||
local_account_password: Chang3MyP@ssw0rd21
|
||||
|
||||
linux_distro_name: rhel_77
|
||||
iso_file_name: CentOS-7-x86_64-DVD-1908.iso
|
||||
linux_ks_folder: rhel7
|
||||
distro_name: rhel8
|
||||
iso_file_name: CentOS-8.4.2105-x86_64-dvd1.iso
|
||||
linux_ks_folder: rhel8
|
||||
|
||||
template_vm_name: centos77-x64-bigdisk_v1
|
||||
template_vm_root_disk_size: 300
|
||||
template_vm_name: centos84-x64-v1
|
||||
template_vm_root_disk_size: 10
|
||||
template_vm_root_disk_format: cow
|
||||
template_vm_root_disk_interface: virtio
|
||||
template_vm_memory: 4096
|
||||
@@ -59,33 +59,9 @@ ovirt_export_domain: export_domain
|
||||
ovirt_iso_domain: iso_domain
|
||||
|
||||
os_short_names:
|
||||
rhel_77:
|
||||
rhel7:
|
||||
ks_folder: rhel7
|
||||
guest_id: rhel_7x64
|
||||
rhel_78:
|
||||
ks_folder: rhel7
|
||||
guest_id: rhel_7x64
|
||||
rhel_80:
|
||||
ks_folder: rhel8
|
||||
guest_id: rhel_8x64
|
||||
rhel_81:
|
||||
ks_folder: rhel8
|
||||
guest_id: rhel_8x64
|
||||
rhel_82:
|
||||
ks_folder: rhel8
|
||||
guest_id: rhel_8x64
|
||||
rhel_83:
|
||||
ks_folder: rhel8
|
||||
guest_id: rhel_8x64
|
||||
centos_77:
|
||||
ks_folder: rhel7
|
||||
guest_id: rhel_7x64
|
||||
centos_80:
|
||||
ks_folder: rhel8
|
||||
guest_id: rhel_8x64
|
||||
centos_81:
|
||||
ks_folder: rhel8
|
||||
guest_id: rhel_8x64
|
||||
centos_82:
|
||||
rhel8:
|
||||
ks_folder: rhel8
|
||||
guest_id: rhel_8x64
|
||||
@@ -1,2 +1,2 @@
|
||||
install_date: Wed May 5 16:14:09 2021
|
||||
install_date: Wed Jun 30 01:12:53 2021
|
||||
version: master
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
- name: validate file
|
||||
stat:
|
||||
path: "{{ playbook_dir }}/{{ temp_directory }}/linux_{{ linux_distro_name }}_ks_autogen.iso"
|
||||
path: "{{ playbook_dir }}/{{ temp_directory }}/linux_{{ distro_name }}_ks_autogen.iso"
|
||||
get_checksum: no
|
||||
register: iso_file_check
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
command: >
|
||||
mkisofs -U -A "OEMDRV" -V "OEMDRV"
|
||||
-volset "OEMDRV" -J -joliet-long -r -v -T
|
||||
-o {{ playbook_dir }}/{{ temp_directory }}/linux_{{ linux_distro_name }}_ks_autogen.iso .
|
||||
-o {{ playbook_dir }}/{{ temp_directory }}/linux_{{ distro_name }}_ks_autogen.iso .
|
||||
args:
|
||||
chdir: "{{ playbook_dir }}/{{ temp_directory }}/ks_iso"
|
||||
|
||||
@@ -25,5 +25,5 @@
|
||||
path: "{{ temp_directory }}/{{ item }}"
|
||||
state: absent
|
||||
loop:
|
||||
- linux_{{ linux_distro_name }}_ks_autogen.iso
|
||||
- linux_{{ distro_name }}_ks_autogen.iso
|
||||
- ks_iso/
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
temp_directory: tmp{{ awx_job_id | default('') }}
|
||||
|
||||
iso_file: "linux_{{ linux_distro_name }}_ks{{ awx_job_id | default('') }}.iso"
|
||||
iso_file: "linux_{{ distro_name }}_ks{{ awx_job_id | default('') }}.iso"
|
||||
|
||||
export_dir: "{{ playbook_dir }}/{{ temp_directory }}"
|
||||
|
||||
@@ -39,8 +39,8 @@ template:
|
||||
dns_servers: "{{ template_vm_dns_servers }}"
|
||||
cd_iso: "{{ iso_file_id | default(iso_file_name) }}" # if using data domain, file name does not work, need to use id
|
||||
|
||||
linux_ks_folder: "{{ os_short_names[(linux_distro_name|default('rhel_80'))].ks_folder | default('rhel8') }}"
|
||||
template_vm_guest_id: "{{ os_short_names[(linux_distro_name|default('rhel_80'))].guest_id | default('rhel_8x64') }}"
|
||||
linux_ks_folder: "{{ os_short_names[(distro_name|default('rhel_80'))].ks_folder | default('rhel8') }}"
|
||||
template_vm_guest_id: "{{ os_short_names[(distro_name|default('rhel_80'))].guest_id | default('rhel_8x64') }}"
|
||||
|
||||
qemu_cmdline_second_iso:
|
||||
- -device
|
||||
|
||||
12
roles/oatakan.rhel_template_build/files/growpart.service
Normal file
12
roles/oatakan.rhel_template_build/files/growpart.service
Normal file
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Extend root partition and resize file system
|
||||
After=local-fs.target
|
||||
Wants=local-fs.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/grow_part.sh
|
||||
Type=oneshot
|
||||
ExecStop=/bin/sh -c "/usr/bin/systemctl disable growpart.service || exit 0"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,2 +1,2 @@
|
||||
install_date: Wed May 5 16:14:08 2021
|
||||
install_date: Wed Jun 30 01:12:52 2021
|
||||
version: master
|
||||
|
||||
25
roles/oatakan.rhel_template_build/tasks/grow_part.yml
Normal file
25
roles/oatakan.rhel_template_build/tasks/grow_part.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
|
||||
- name: ensure growpart packages are installed
|
||||
package:
|
||||
name:
|
||||
- cloud-utils-growpart
|
||||
- gdisk
|
||||
|
||||
- name: create growpart cloud-init script to grow partition on boot
|
||||
template:
|
||||
src: grow_part.sh.j2
|
||||
dest: /usr/local/bin/grow_part.sh
|
||||
mode: u=rwx,g=rx,o=rx
|
||||
|
||||
- name: copy growpart service
|
||||
copy:
|
||||
src: growpart.service
|
||||
dest: /etc/systemd/system/growpart.service
|
||||
|
||||
- name: reload service
|
||||
systemd:
|
||||
name: growpart
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
state: stopped
|
||||
@@ -103,6 +103,9 @@
|
||||
- include_tasks: cloud-init.yml
|
||||
when: target_ovirt | bool
|
||||
|
||||
- include_tasks: grow_part.yml
|
||||
when: not (target_ovirt | bool)
|
||||
|
||||
- include_tasks: ovirt.yml
|
||||
when: target_ovirt | bool
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
install_date: Wed May 5 16:14:04 2021
|
||||
install_date: Wed Jun 30 01:12:48 2021
|
||||
version: master
|
||||
|
||||
@@ -47,7 +47,7 @@ Including an example of how to use your role (for instance, with variables passe
|
||||
export_ovf: no # export the template to export domain upon creation
|
||||
local_account_password: ''
|
||||
local_administrator_password: ''
|
||||
windows_distro_name: 2019_standard # this needs to be one of the standard values see 'os_short_names' var
|
||||
distro_name: win2019 # this needs to be one of the standard values see 'os_short_names' var
|
||||
template_vm_name: win2019_template
|
||||
template_vm_root_disk_size: 30
|
||||
template_vm_guest_id: windows_2019x64
|
||||
|
||||
@@ -19,8 +19,8 @@ custom_efi_enabled: no
|
||||
custom_efi_path: /usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd
|
||||
|
||||
qemu_second_cdrom_device_bus_type: ide
|
||||
qemu_second_cdrom_device_bus_id: 3
|
||||
qemu_second_cdrom_device_bus_unit: 0
|
||||
qemu_second_cdrom_device_bus_id: 3 # tested with Q35 chipset, if using I440FX chipset, try setting this to 1
|
||||
qemu_second_cdrom_device_bus_unit: 0 # tested with Q35 chipset, if using I440FX chipset, try setting this to 1
|
||||
|
||||
virtio_iso_url: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.173-2/virtio-win.iso
|
||||
winrm_enable_script_url: https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1
|
||||
@@ -33,7 +33,7 @@ local_administrator_password: Chang3MyP@ssw0rd21
|
||||
local_account_username: ansible
|
||||
local_account_password: Chang3MyP@ssw0rd21
|
||||
|
||||
windows_distro_name: 2019_standard_core
|
||||
distro_name: win2019
|
||||
iso_file_name: 17763.253.190108-0006.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us.iso
|
||||
windows_sysprep_template_folder: windows_server
|
||||
|
||||
@@ -69,10 +69,8 @@ ovirt_export_domain: export_domain
|
||||
ovirt_iso_domain: iso_domain
|
||||
|
||||
os_short_names:
|
||||
2008_r2_standard: 2k8R2
|
||||
2012_r2_standard: 2k12R2
|
||||
2012_r2_datacenter: 2k12R2
|
||||
2016_standard: 2k16
|
||||
2016_standard_core: 2k16
|
||||
2019_standard: 2k19
|
||||
2019_standard_core: 2k19
|
||||
win2008: 2k8R2
|
||||
win2012: 2k12R2
|
||||
win2016: 2k16
|
||||
win2019: 2k19
|
||||
win10: 10
|
||||
@@ -1,2 +1,2 @@
|
||||
install_date: Wed May 5 16:14:00 2021
|
||||
install_date: Wed Jun 30 01:12:45 2021
|
||||
version: ''
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
- name: validate file
|
||||
stat:
|
||||
path: "{{ playbook_dir }}/{{ temp_directory }}/windows_{{ windows_distro_name }}_autounattend_autogen.iso"
|
||||
path: "{{ playbook_dir }}/{{ temp_directory }}/windows_{{ distro_name }}_autounattend_autogen.iso"
|
||||
get_checksum: no
|
||||
register: iso_file_check
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
include_tasks: virtio_drivers.yml
|
||||
|
||||
- name: create iso
|
||||
command: mkisofs -V ADDISO -r -iso-level 4 -o {{ playbook_dir }}/{{ temp_directory }}/windows_{{ windows_distro_name }}_autounattend_autogen.iso .
|
||||
command: mkisofs -V ADDISO -r -iso-level 4 -o {{ playbook_dir }}/{{ temp_directory }}/windows_{{ distro_name }}_autounattend_autogen.iso .
|
||||
args:
|
||||
chdir: "{{ playbook_dir }}/{{ temp_directory }}/ks_iso"
|
||||
|
||||
@@ -34,6 +34,6 @@
|
||||
path: "{{ temp_directory }}/{{ item }}"
|
||||
state: absent
|
||||
loop:
|
||||
- windows_{{ windows_distro_name }}_autounattend_autogen.iso
|
||||
- windows_{{ distro_name }}_autounattend_autogen.iso
|
||||
- virtio_win.iso
|
||||
- ks_iso/
|
||||
@@ -12,8 +12,8 @@
|
||||
- name: set list of directories to copy
|
||||
set_fact:
|
||||
virtio_iso_list_of_directories_to_extract:
|
||||
- /viostor/{{ os_short_names[windows_distro_name] | default('2k16') }}/amd64
|
||||
- /NetKVM/{{ os_short_names[windows_distro_name] | default('2k16') }}/amd64
|
||||
- /viostor/{{ os_short_names[distro_name] | default('2k16') }}/amd64
|
||||
- /NetKVM/{{ os_short_names[distro_name] | default('2k16') }}/amd64
|
||||
|
||||
- name: get a list of files from template iso
|
||||
shell: >
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
</ModifyPartition>
|
||||
<ModifyPartition wcm:action="modify">
|
||||
<Format>NTFS</Format>
|
||||
<Label>{{ windows_distro_name[0:31] }}</Label>
|
||||
<Label>{{ distro_name[0:31] }}</Label>
|
||||
<Letter>C</Letter>
|
||||
<Order>2</Order>
|
||||
<PartitionID>2</PartitionID>
|
||||
@@ -78,7 +78,7 @@
|
||||
<Letter>C</Letter>
|
||||
<Order>4</Order>
|
||||
<PartitionID>4</PartitionID>
|
||||
<Label>{{ windows_distro_name[0:31] }}</Label>
|
||||
<Label>{{ distro_name[0:31] }}</Label>
|
||||
</ModifyPartition>
|
||||
</ModifyPartitions>
|
||||
<DiskID>0</DiskID>
|
||||
@@ -158,7 +158,7 @@
|
||||
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<OOBE>
|
||||
<HideEULAPage>true</HideEULAPage>
|
||||
{% if not '2008' in windows_distro_name %}
|
||||
{% if not '2008' in distro_name %}
|
||||
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
|
||||
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
|
||||
<HideLocalAccountScreen>true</HideLocalAccountScreen>
|
||||
@@ -219,7 +219,7 @@
|
||||
<Order>1</Order>
|
||||
<RequiresUserInput>true</RequiresUserInput>
|
||||
</SynchronousCommand>
|
||||
{% if not '2008' in windows_distro_name %}
|
||||
{% if not '2008' in distro_name %}
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<CommandLine>cmd.exe /c powershell -Command "Set-NetConnectionProfile -NetworkCategory Private"</CommandLine>
|
||||
<Description>Set network connection profile to private</Description>
|
||||
@@ -305,8 +305,32 @@
|
||||
<Order>15</Order>
|
||||
<RequiresUserInput>true</RequiresUserInput>
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<CommandLine>cmd.exe /c dism /online /enable-feature /featurename:NetFx2-ServerCore</CommandLine>
|
||||
<Description>Enable NetFx2-ServerCore feature</Description>
|
||||
<Order>16</Order>
|
||||
<RequiresUserInput>true</RequiresUserInput>
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<CommandLine>cmd.exe /c dism /online /enable-feature /featurename:NetFx2-ServerCore-WOW64</CommandLine>
|
||||
<Description>Enable NetFx2-ServerCore feature</Description>
|
||||
<Order>17</Order>
|
||||
<RequiresUserInput>true</RequiresUserInput>
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<CommandLine>cmd.exe /c dism /online /enable-feature /featurename:MicrosoftWindowsPowerShell</CommandLine>
|
||||
<Description>Enable MicrosoftWindowsPowerShell feature</Description>
|
||||
<Order>18</Order>
|
||||
<RequiresUserInput>true</RequiresUserInput>
|
||||
</SynchronousCommand>
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<CommandLine>cmd.exe /c dism /online /enable-feature /featurename:ServerManager-PSH-Cmdlets</CommandLine>
|
||||
<Description>Enable ServerManager-PSH-Cmdlets feature</Description>
|
||||
<Order>19</Order>
|
||||
<RequiresUserInput>true</RequiresUserInput>
|
||||
</SynchronousCommand>
|
||||
{% endif %}
|
||||
{% if '2016' in windows_distro_name %}
|
||||
{% if '2016' in distro_name %}
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<CommandLine>cmd.exe /c reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SchUseStrongCrypto /t REG_DWORD /d 1 /reg:64 /f</CommandLine>
|
||||
<Description>Configure security protocol</Description>
|
||||
@@ -333,7 +357,7 @@
|
||||
<RequiresUserInput>true</RequiresUserInput>
|
||||
</SynchronousCommand>
|
||||
{% if template.networks is defined and template.networks[0].ip is defined and template.networks[0].gateway is defined and template.networks[0].netmask is defined %}
|
||||
{% if not '2008' in windows_distro_name %}
|
||||
{% if not '2008' in distro_name %}
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<CommandLine>cmd.exe /c powershell -Command "New-NetIPAddress –IPAddress {{ template.networks[0].ip }} -DefaultGateway {{ template.networks[0].gateway }} -PrefixLength {{ (template.networks[0].ip + '/' + template.networks[0].netmask) | ipaddr('prefix') }} -InterfaceIndex (Get-NetAdapter).InterfaceIndex"</CommandLine>
|
||||
<Description>Set static ip</Description>
|
||||
@@ -349,7 +373,7 @@
|
||||
</SynchronousCommand>
|
||||
{% endif %}
|
||||
{% if template.networks[0].dns_servers is defined %}
|
||||
{% if not '2008' in windows_distro_name %}
|
||||
{% if not '2008' in distro_name %}
|
||||
<SynchronousCommand wcm:action="add">
|
||||
<CommandLine>cmd.exe /c powershell -Command "Set-DNSClientServerAddress –InterfaceIndex (Get-NetAdapter).InterfaceIndex –ServerAddresses {{ template.networks[0].dns_servers|join(',') }}"</CommandLine>
|
||||
<Description>Set static ip</Description>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
temp_directory: tmp{{ awx_job_id | default('') }}
|
||||
|
||||
iso_file: "windows_{{ windows_distro_name }}_autounattend{{ awx_job_id | default('') }}.iso"
|
||||
iso_file: "windows_{{ distro_name }}_autounattend{{ awx_job_id | default('') }}.iso"
|
||||
|
||||
export_dir: "{{ playbook_dir }}/{{ temp_directory }}"
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
install_date: Wed May 5 16:14:01 2021
|
||||
install_date: Wed Jun 30 01:12:46 2021
|
||||
version: master
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
arguments: '/qb!'
|
||||
register: install_visual_c
|
||||
until: install_visual_c is success
|
||||
delay: 3
|
||||
retries: 5
|
||||
delay: 10
|
||||
retries: 60
|
||||
when: "'Windows Server 2008' in ansible_distribution"
|
||||
|
||||
- name: stop windows update service
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
|
||||
- name: check if powershell is available
|
||||
raw: 'Get-Host'
|
||||
failed_when: False
|
||||
check_mode: no
|
||||
register: check_powershell
|
||||
|
||||
- block:
|
||||
- name: enable powershell
|
||||
raw: '{{ item }}'
|
||||
args:
|
||||
executable: cmd.exe
|
||||
changed_when: False
|
||||
check_mode: no
|
||||
loop:
|
||||
- dism /online /enable-feature /featurename:NetFx2-ServerCore
|
||||
- dism /online /enable-feature /featurename:MicrosoftWindowsPowerShell
|
||||
- dism /online /enable-feature /featurename:ServerManager-PSH-Cmdlets
|
||||
|
||||
- name: reboot system
|
||||
raw: shutdown /r /t 5
|
||||
args:
|
||||
executable: cmd.exe
|
||||
changed_when: False
|
||||
check_mode: no
|
||||
|
||||
- pause:
|
||||
seconds: 30
|
||||
when:
|
||||
- check_powershell.stderr is defined
|
||||
- ('is not recognized' in check_powershell.stderr)
|
||||
@@ -20,7 +20,7 @@
|
||||
ignore_errors: yes
|
||||
|
||||
- name: create a scheduled task to install hotfix
|
||||
raw: SCHTASKS /Create /SC MONTHLY /MO first /D SUN /TN hotfix_install /TR "{{ enable_tls_support_hotfix_download_location }}\\{{ enable_tls_support_hotfix.file }} /quiet /norestart"
|
||||
raw: SCHTASKS /Create /SC MONTHLY /MO first /D SUN /TN hotfix_install /TR "{{ enable_tls_support_hotfix_download_location }}\\{{ enable_tls_support_hotfix.file }} /quiet /restart"
|
||||
args:
|
||||
executable: cmd.exe
|
||||
changed_when: False
|
||||
@@ -34,7 +34,7 @@
|
||||
check_mode: no
|
||||
|
||||
- pause:
|
||||
seconds: 30
|
||||
seconds: 60
|
||||
|
||||
- name: delete scheduled task (hotfix)
|
||||
raw: 'SCHTASKS /Delete /TN hotfix_install /f'
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
---
|
||||
|
||||
- include_tasks: enable_powershell.yml
|
||||
|
||||
- include_tasks: enable_tls_system_default.yml
|
||||
|
||||
- name: download script
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
- name: wait for system to reboot after fix
|
||||
wait_for_connection:
|
||||
delay: 240
|
||||
delay: 300
|
||||
sleep: 30
|
||||
timeout: 300
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
install_date: Wed May 5 16:14:06 2021
|
||||
install_date: Wed Jun 30 01:12:50 2021
|
||||
version: master
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
install_date: Wed May 5 16:14:05 2021
|
||||
install_date: Wed Jun 30 01:12:49 2021
|
||||
version: master
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
- name: ikke_t.container_image_cleanup
|
||||
|
||||
# Infra
|
||||
#- name: bertvv.bind
|
||||
#- name: bertvv.dhcp
|
||||
- name: sage905.dhcp
|
||||
src: https://github.com/ptoal/ansible-role-dhcp.git
|
||||
- name: linux-system-roles.network
|
||||
|
||||
13
roles/sage905.dhcp/.gitignore
vendored
13
roles/sage905.dhcp/.gitignore
vendored
@@ -1,13 +0,0 @@
|
||||
# .gitignore
|
||||
|
||||
# Hidden Vagrant-directory
|
||||
.vagrant
|
||||
|
||||
# Backup files (e.g. Vim, Gedit, etc.)
|
||||
*~
|
||||
|
||||
# Vagrant base boxes (you never know when someone puts one in the repository)
|
||||
*.box
|
||||
|
||||
# Ignore test code (it's a separate branch worktree)
|
||||
*tests/
|
||||
@@ -1,21 +0,0 @@
|
||||
---
|
||||
# Based on ansible-lint config
|
||||
extends: default
|
||||
|
||||
rules:
|
||||
braces: {max-spaces-inside: 1, level: error}
|
||||
brackets: {max-spaces-inside: 1, level: error}
|
||||
colons: {max-spaces-after: -1, level: error}
|
||||
commas: {max-spaces-after: -1, level: error}
|
||||
comments: disable
|
||||
comments-indentation: disable
|
||||
document-start: disable
|
||||
empty-lines: {max: 3, level: error}
|
||||
hyphens: {level: error}
|
||||
indentation: disable
|
||||
key-duplicates: enable
|
||||
line-length: disable
|
||||
new-line-at-end-of-file: disable
|
||||
new-lines: {type: unix}
|
||||
trailing-spaces: disable
|
||||
truthy: disable
|
||||
@@ -1,233 +0,0 @@
|
||||
# Ansible role `dhcp`
|
||||
|
||||
Ansible role for setting up ISC DHCPD. The responsibilities of this role are to install packages and manage the configuration ([dhcpd.conf(5)](http://linux.die.net/man/5/dhcpd.conf)). Managing the firewall configuration is NOT a concern of this role. You can do this in your local playbook, or use another role (e.g. [bertvv.rh-base](https://galaxy.ansible.com/bertvv/rh-base).
|
||||
|
||||
Refer to the [change log](CHANGELOG.md) for notable changes in each release.
|
||||
|
||||
Do you use/like this role? Please consider giving it a star. If you [rate this role](https://galaxy.ansible.com/bertvv/dhcp) on Ansible Galaxy and find it lacking in some respect, please consider opening an Issue with actionable feedback or a PR so we can improve it. Thank you!
|
||||
|
||||
## Requirements
|
||||
|
||||
No specific requirements
|
||||
|
||||
## Role Variables
|
||||
|
||||
This role is able to set global options, and to specify subnet declarations.
|
||||
|
||||
See the [test playbook](https://github.com/bertvv/ansible-role-dhcp/blob/vagrant-tests/test.yml) for a working example of a DHCP server in a test environment based on Vagrant and VirtualBox. This section is a reference of all supported options.
|
||||
|
||||
### Global options
|
||||
|
||||
The following variables, when set, will be added to the global section of the DHCP configuration file. If there is no default value specified, the corresponding setting will be left out of `dhcpd.conf(5)`.
|
||||
|
||||
See the [dhcp-options(5)](http://linux.die.net/man/5/dhcp-options) man page for more information about these options.
|
||||
|
||||
| Variable | Comments |
|
||||
| :--- | :--- |
|
||||
| `dhcp_global_authoritative` | Global authoritative statement (`authoritative`, `not authoritative`) |
|
||||
| `dhcp_global_booting` | Global booting (`allow`, `deny`, `ignore`) |
|
||||
| `dhcp_global_bootp` | Global bootp (`allow`, `deny`, `ignore`) |
|
||||
| `dhcp_global_broadcast_address` | Global broadcast address |
|
||||
| `dhcp_global_classes` | Class definitions with a match statement(1) |
|
||||
| `dhcp_global_default_lease_time` | Default lease time in seconds |
|
||||
| `dhcp_global_domain_name_servers` | A list of IP addresses of DNS servers(2) |
|
||||
| `dhcp_global_domain_name` | The domain name the client should use when resolving host names |
|
||||
| `dhcp_global_domain_search` | A list of domain names to be used by the client to locate non-FQDNs(1) |
|
||||
| `dhcp_global_failover` | Failover peer settings (3) |
|
||||
| `dhcp_global_failover_peer` | Name for the failover peer (e.g. `foo`) |
|
||||
| `dhcp_global_filename` | Filename to request for boot |
|
||||
| `dhcp_global_includes_missing` | Boolean. Continue if `includes` file(s) missing from role's files/ |
|
||||
| `dhcp_global_includes` | List of config files to be included (from `dhcp_config_dir`) |
|
||||
| `dhcp_global_log_facility` | Global log facility (e.g. `daemon`, `syslog`, `user`, ...) |
|
||||
| `dhcp_global_max_lease_time` | Maximum lease time in seconds |
|
||||
| `dhcp_global_next_server` | IP for PXEboot server |
|
||||
| `dhcp_global_ntp_servers` | List of IP addresses of NTP servers |
|
||||
| `dhcp_global_omapi_port` | OMAPI port |
|
||||
| `dhcp_global_omapi_secret` | OMAPI secret |
|
||||
| `dhcp_global_other_options` | Array of arbitrary additional global options |
|
||||
| `dhcp_global_routers` | IP address of the router |
|
||||
| `dhcp_global_server_name` | Server name sent to the client |
|
||||
| `dhcp_global_server_state` | Service state (started, stopped) |
|
||||
| `dhcp_global_subnet_mask` | Global subnet mask |
|
||||
|
||||
**Remarks**
|
||||
|
||||
(1) This role supports the definition of classes with a match statement, e.g.:
|
||||
|
||||
```Yaml
|
||||
# Class for VirtualBox VMs
|
||||
dhcp_global_classes:
|
||||
- name: vbox
|
||||
match: 'match if binary-to-ascii(16,8,":",substring(hardware, 1, 3)) = "8:0:27"'
|
||||
```
|
||||
|
||||
Class names can be used in the definition of address pools (see below).
|
||||
|
||||
(2) The role variable `dhcp_global_domain_name_servers` may be written either as a list (when you have more than one item), or as a string (when you have only one). The following snippet shows an example of both:
|
||||
|
||||
```Yaml
|
||||
# A single DNS server
|
||||
dhcp_global_domain_name_servers: 8.8.8.8
|
||||
|
||||
# A list of DNS servers
|
||||
dhcp_global_domain_name_servers:
|
||||
- 8.8.8.8
|
||||
- 8.8.4.4
|
||||
```
|
||||
|
||||
(3) This role also supports the definition of a failover peer, e.g.:
|
||||
|
||||
```Yaml
|
||||
# Failover peer definition
|
||||
dhcp_global_failover_peer: failover-group
|
||||
dhcp_global_failover:
|
||||
role: primary # | secondary
|
||||
address: 192.168.222.2
|
||||
port: 647
|
||||
peer_address: 192.168.222.3
|
||||
peer_port: 647
|
||||
max_response_delay: 15
|
||||
max_unacked_updates: 10
|
||||
load_balance_max_seconds: 5
|
||||
split: 255
|
||||
mclt: 3600
|
||||
```
|
||||
|
||||
The variable `dhcp_global_failover_peer` contains a name for the configured peer, to be used on a per pool basis. The failover declaration options are specified with the variable `dhcp_global_failover`, a dictionary that may contain the following options:
|
||||
|
||||
| Option | Required | Comment |
|
||||
| :--- | :---: | :-- |
|
||||
| `address` | no | This server's IP address |
|
||||
| `hba` | no | colon-separated-hex-list |
|
||||
| `load_balance_max_seconds` | no | Cutoff after which load balance is disabled (3 to 5 recommended) |
|
||||
| `max-balance` | no | Failover pool balance statement |
|
||||
| `max-lease-misbalance` | no | Failover pool balance statement |
|
||||
| `max-lease-ownership` | no | Failover pool balance statement |
|
||||
| `max_response_delay` | no | Maximum seconds without contact before engaging failover |
|
||||
| `max_unacked_updates` | no | Maximum BNDUPD it can send before receiving a BNDACK (10 recommended) |
|
||||
| `mclt` | no | Maximum Client Lead Time |
|
||||
| `min-balance` | no | Failover pool balance statement |
|
||||
| `peer_address` | no | Failover peer's IP addres |
|
||||
| `peer_port` | no | This server's port (generally 519/520 or 647/847) |
|
||||
| `port` | no | This server's port (generally 519/520 or 647/847) |
|
||||
| `role` | no | primary, secondary |
|
||||
| `split` | no | Load balance split (0-255) |
|
||||
|
||||
The failover peer directive has to be in the definition of address pools (see below).
|
||||
|
||||
### Subnet declarations
|
||||
|
||||
The role variable `dhcp_subnets` contains a list of dicts, specifying the subnet declarations to be added to the DHCP configuration file. Every subnet declaration should have an `ip` and `netmask`, other options are not mandatory. We start this section with an example, a complete overview of supported options follows.
|
||||
|
||||
```Yaml
|
||||
dhcp_subnets:
|
||||
- ip: 192.168.222.0
|
||||
netmask: 255.255.255.128
|
||||
domain_name_servers:
|
||||
- 10.0.2.3
|
||||
- 10.0.2.4
|
||||
range_begin: 192.168.222.50
|
||||
range_end: 192.168.222.127
|
||||
- ip: 192.168.222.128
|
||||
default_lease_time: 3600
|
||||
max_lease_time: 7200
|
||||
netmask: 255.255.255.128
|
||||
domain_name_servers: 10.0.2.3
|
||||
routers: 192.168.222.129
|
||||
```
|
||||
|
||||
An alphabetical list of supported options in a subnet declaration:
|
||||
|
||||
| Option | Required | Comment |
|
||||
| :--- | :---: | :-- |
|
||||
| `booting` | no | allow,deny,ignore |
|
||||
| `bootp` | no | allow,deny,ignore |
|
||||
| `default_lease_time` | no | Default lease time for this subnet (in seconds) |
|
||||
| `domain_name_servers` | no | List of domain name servers for this subnet(1) |
|
||||
| `domain_search` | no | List of domain names for resolution of non-FQDNs(1) |
|
||||
| `filename` | no | filename to retrieve from boot server |
|
||||
| `hosts` | no | List of fixed IP address hosts for each subnet, similar to dhcp_hosts |
|
||||
| `ip` | yes | **Required.** IP address of the subnet |
|
||||
| `max_lease_time` | no | Maximum lease time for this subnet (in seconds) |
|
||||
| `netmask` | yes | **Required.** Network mask of the subnet (in dotted decimal notation) |
|
||||
| `next_server` | no | IP address of the boot server |
|
||||
| `range_begin` | no | Lowest address in the range of dynamic IP addresses to be assigned |
|
||||
| `range_end` | no | Highest address in the range of dynamic IP addresses to be assigned |
|
||||
| `ranges` | no | If multiple ranges are needed, they can be specified as a list (2) |
|
||||
| `routers` | no | IP address of the gateway for this subnet |
|
||||
| `server_name` | no | Server name sent to the client |
|
||||
| `subnet_mask` | no | Overrides the `netmask` of the subnet declaration |
|
||||
|
||||
You can specify address pools within a subnet by setting the `pools` options. This allows you to specify a pool of addresses that will be treated differently than another pool of addresses, even on the same network segment or subnet. It is a list of dicts with the following keys, all of which are optional:
|
||||
|
||||
| Option | Comment |
|
||||
| :--- | :--- |
|
||||
| `allow` | Specifies which hosts are allowed in this pool(1) |
|
||||
| `default_lease_time` | The default lease time for this pool |
|
||||
| `deny` | Specifies which hosts are not allowed in this pool |
|
||||
| `domain_name_servers` | The domain name servers to be used for this pool(1) |
|
||||
| `max_lease_time` | The maximum lease time for this pool |
|
||||
| `min_lease_time` | The minimum lease time for this pool |
|
||||
| `range_begin` | The lowest address in this pool |
|
||||
| `range_end` | The highest address in this pool |
|
||||
|
||||
(1) For the `allow` and `deny` fields, the options are enumerated in [dhcpd.conf(5)](http://linux.die.net/man/5/dhcpd.conf), but include:
|
||||
|
||||
- `booting`
|
||||
- `bootp`
|
||||
- `client-updates`
|
||||
- `known-clients`
|
||||
- `members of "CLASS"`
|
||||
- `unknown-clients`
|
||||
|
||||
(2) For multiple subnet ranges, they can be specified, thus:
|
||||
|
||||
```Yaml
|
||||
ranges:
|
||||
- { begin: 192.168.222.50, end: 192.168.222.99 }
|
||||
- { begin: 192.168.222.110, end: 192.168.222.127 }
|
||||
```
|
||||
|
||||
### Host declarations
|
||||
|
||||
You can specify hosts that should get a fixed IP address based on their MAC by setting the `dhcp_hosts` option. This is a list of dicts with the following three keys, of which `name` and `mac` are mandatory:
|
||||
|
||||
| Option | Comment |
|
||||
| :--- | :--- |
|
||||
| `name` | The name of the host |
|
||||
| `mac` | The MAC address of the host |
|
||||
| `ip` | The IP address to be assigned to the host |
|
||||
|
||||
```Yaml
|
||||
dhcp_hosts:
|
||||
- name: cl1
|
||||
mac: '00:11:22:33:44:55'
|
||||
ip: 192.168.222.150
|
||||
- name: cl2
|
||||
mac: '00:de:ad:be:ef:00'
|
||||
ip: 192.168.222.151
|
||||
```
|
||||
|
||||
### Specify PXEBoot server
|
||||
|
||||
Setting the variable `dhcp_pxeboot_server`, will redirect PXE clients to the specified PXEBoot server in order to boot over the network. The specified server should have boot images on the expected locations. Use e.g. [bertvv.pxeserver](https://galaxy.ansible.com/bertvv/pxeserver) to configure it.
|
||||
|
||||
## Dependencies
|
||||
|
||||
No dependencies.
|
||||
|
||||
## Example Playbook
|
||||
|
||||
See the [test playbook](https://github.com/bertvv/ansible-role-dhcp/blob/vagrant-tests/test.yml)
|
||||
|
||||
## Testing
|
||||
|
||||
Tests for this role are provided in the form of a Vagrant environment that is kept in a separate branch, `vagrant-tests`. For more information about setting up the test environment and running the tests, refer to the [README](https://github.com/bertvv/ansible-role-dhcp/blob/vagrant-tests/README.md) of the test branch.
|
||||
|
||||
## License
|
||||
|
||||
BSD
|
||||
|
||||
## Contributing
|
||||
|
||||
Issues, feature requests, ideas are appreciated and can be posted in the Issues section. Pull requests are also very welcome. Preferably, create a topic branch and when submitting, squash your commits into one (with a descriptive message).
|
||||
@@ -1,5 +0,0 @@
|
||||
# roles/dhcp/defaults/main.yml
|
||||
---
|
||||
dhcp_global_includes_missing: false
|
||||
dhcp_packages_state: "present"
|
||||
dhcp_subnets: []
|
||||
@@ -1,7 +0,0 @@
|
||||
# roles/dhcp/handlers/main.yml
|
||||
---
|
||||
|
||||
- name: restart dhcp
|
||||
service:
|
||||
name: "{{ dhcp_service }}"
|
||||
state: "{{ (dhcp_global_server_state | default('started') == 'started') | ternary('restarted', 'stopped') }}"
|
||||
@@ -1,2 +0,0 @@
|
||||
install_date: Sun Jun 28 14:49:12 2020
|
||||
version: v3.0.1
|
||||
@@ -1,17 +0,0 @@
|
||||
---
|
||||
galaxy_info:
|
||||
author:
|
||||
description: Ansible role for setting up ISC DHCPD.
|
||||
license: BSD
|
||||
min_ansible_version: 2.9
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- 7
|
||||
- name: Fedora
|
||||
versions:
|
||||
- 29
|
||||
galaxy_tags:
|
||||
- system
|
||||
- networking
|
||||
dependencies: []
|
||||
@@ -1,50 +0,0 @@
|
||||
# roles/dhcp/tasks/main.yml
|
||||
---
|
||||
|
||||
- name: Load distro-specific variables
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- "{{ ansible_distribution }}.yml"
|
||||
- "{{ ansible_os_family }}.yml"
|
||||
- "{{ default }}.yml"
|
||||
tags: dhcp
|
||||
|
||||
- name: Install packages
|
||||
package:
|
||||
name: "{{ dhcp_packages }}"
|
||||
state: "{{ dhcp_packages_state }}"
|
||||
tags: dhcp
|
||||
|
||||
- name: Install includes
|
||||
copy:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ dhcp_config_dir }}/{{ item | basename }}"
|
||||
with_items: "{{ dhcp_global_includes }}"
|
||||
when: dhcp_global_includes is defined
|
||||
ignore_errors: "{{ dhcp_global_includes_missing }}"
|
||||
tags: dhcp
|
||||
|
||||
- name: Set config directory perms
|
||||
file:
|
||||
path: "{{ dhcp_config | dirname }}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
tags: dhcp
|
||||
|
||||
- name: Install config file
|
||||
template:
|
||||
src: etc_dhcp_dhcpd.conf.j2
|
||||
dest: "{{ dhcp_config }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
validate: 'dhcpd -t -cf %s'
|
||||
notify: restart dhcp
|
||||
tags: dhcp
|
||||
|
||||
- name: "Ensure service is {{ dhcp_global_server_state | default('started') }}"
|
||||
service:
|
||||
name: "{{ dhcp_service }}"
|
||||
state: "{{ dhcp_global_server_state | default('started') }}"
|
||||
enabled: true
|
||||
tags: dhcp
|
||||
@@ -1,296 +0,0 @@
|
||||
# ISC DHCPD configuration -- don't edit manually!
|
||||
#
|
||||
# {{ ansible_managed }}
|
||||
|
||||
#
|
||||
# Global options
|
||||
#
|
||||
{% if dhcp_global_omapi_port is defined %}
|
||||
omapi-port {{ dhcp_global_omapi_port }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_omapi_secret is defined %}
|
||||
key omapi_key {
|
||||
algorithm HMAC-MD5;
|
||||
secret "{{ dhcp_global_omapi_secret }}";
|
||||
};
|
||||
{% endif %}
|
||||
{% if dhcp_global_authoritative is defined %}
|
||||
{{ dhcp_global_authoritative }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_log_facility is defined %}
|
||||
log-facility {{ dhcp_global_log_facility }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_bootp is defined %}
|
||||
{{ dhcp_global_bootp }} bootp;
|
||||
{% endif %}
|
||||
{% if dhcp_global_booting is defined %}
|
||||
{{ dhcp_global_booting }} booting;
|
||||
{% endif %}
|
||||
{% if dhcp_global_next_server is defined %}
|
||||
next-server {{ dhcp_global_next_server}};
|
||||
{% endif %}
|
||||
{% if dhcp_global_filename is defined %}
|
||||
filename "{{ dhcp_global_filename }}";
|
||||
{% endif %}
|
||||
{% if dhcp_global_default_lease_time is defined %}
|
||||
default-lease-time {{ dhcp_global_default_lease_time }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_max_lease_time is defined %}
|
||||
max-lease-time {{ dhcp_global_max_lease_time }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_subnet_mask is defined %}
|
||||
option subnet-mask {{ dhcp_global_subnet_mask }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_broadcast_address is defined %}
|
||||
option broadcast-address {{ dhcp_global_broadcast_address }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_routers is defined %}
|
||||
option routers {{ dhcp_global_routers }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_domain_name is defined %}
|
||||
option domain-name "{{ dhcp_global_domain_name }}";
|
||||
{% endif %}
|
||||
{% if dhcp_global_ntp_servers is defined %}
|
||||
{% if dhcp_global_ntp_servers is string %}
|
||||
option ntp-servers {{ dhcp_global_ntp_servers }};
|
||||
{% else %}
|
||||
option ntp-servers {{ dhcp_global_ntp_servers|join(', ') }};
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if dhcp_global_domain_name_servers is defined %}
|
||||
{% if dhcp_global_domain_name_servers is string %}
|
||||
option domain-name-servers {{ dhcp_global_domain_name_servers }};
|
||||
{% else %}
|
||||
option domain-name-servers {{ dhcp_global_domain_name_servers|join(', ') }};
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if dhcp_global_domain_search is defined %}
|
||||
{% if dhcp_global_domain_search is string %}
|
||||
option domain-search "{{ dhcp_global_domain_search }}";
|
||||
{% else %}
|
||||
option domain-search "{{ dhcp_global_domain_search|join('", "') }}";
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if dhcp_global_server_name is defined %}
|
||||
option server-name "{{ dhcp_global_server_name }}";
|
||||
{% endif %}
|
||||
{% if dhcp_global_other_options is defined %}
|
||||
{% for option in dhcp_global_other_options %}
|
||||
option {{ option }};
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if dhcp_global_failover_peer is defined %}
|
||||
|
||||
#
|
||||
# DHCP Failover config
|
||||
#
|
||||
# Notes: In the past couple years, TCP ports 647 (primary) and 847 (peer) have
|
||||
# emerged as the standard bindings for DHCP dhcp_global_failover It is worth noting that as
|
||||
# recently as 2005, the dhcpd.conf(5) man page used ports 519 and 520 in its
|
||||
# failover example, but 647 and 847 look like good choices as of 2008. However,
|
||||
# the dhcpd.conf(5) man page says that the primary port and the peer port may be
|
||||
# the same number.
|
||||
|
||||
failover peer "{{ dhcp_global_failover_peer }}" {
|
||||
{% if dhcp_global_failover.role is defined %}
|
||||
# [ primary | secondary ];
|
||||
{{ dhcp_global_failover.role }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_failover.address is defined %}
|
||||
address {{ dhcp_global_failover.address }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_failover.port is defined %}
|
||||
port {{ dhcp_global_failover.port }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_failover.peer_address is defined %}
|
||||
peer address {{ dhcp_global_failover.peer_address }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_failover.peer_port is defined %}
|
||||
peer port {{ dhcp_global_failover.peer_port }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_failover.max_response_delay is defined %}
|
||||
max-response-delay {{ dhcp_global_failover.max_response_delay }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_failover.max_unacked_updates is defined %}
|
||||
max-unacked-updates {{ dhcp_global_failover.max_unacked_updates }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_failover.split is defined %}
|
||||
split {{ dhcp_global_failover.split }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_failover.hba is defined %}
|
||||
hba {{ dhcp_global_failover.hba }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_failover.mclt is defined %}
|
||||
mclt {{ dhcp_global_failover.mclt }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_failover.load_balance_max_seconds is defined %}
|
||||
load balance max seconds {{ dhcp_global_failover.load_balance_max_seconds }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_failover.max_lease_misbalance is defined %}
|
||||
max-lease-misbalance {{ dhcp_global_failover.max_lease_misbalance }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_failover.max_lease_ownership is defined %}
|
||||
max-lease-ownership {{ dhcp_global_failover.max_lease_ownership }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_failover.min_balance is defined %}
|
||||
min-balance {{ dhcp_global_failover.min_balance }};
|
||||
{% endif %}
|
||||
{% if dhcp_global_failover.max_balance is defined %}
|
||||
max-balance {{ dhcp_global_failover.max_balance }};
|
||||
{% endif %}
|
||||
}
|
||||
{% endif %}
|
||||
{% if dhcp_global_includes is defined %}
|
||||
#
|
||||
# Includes
|
||||
#
|
||||
{% for include in dhcp_global_includes %}
|
||||
include "{{ dhcp_config_dir }}/{{ include | basename }}";
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if dhcp_global_classes is defined %}
|
||||
#
|
||||
# Classes
|
||||
#
|
||||
{% for class in dhcp_global_classes %}
|
||||
class "{{ class.name }}" {
|
||||
{% if class.match is defined %}
|
||||
{{ class.match }};
|
||||
{% endif %}
|
||||
}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
#
|
||||
# Subnet declarations
|
||||
#
|
||||
{% for subnet in dhcp_subnets %}
|
||||
subnet {{ subnet.ip }} netmask {{ subnet.netmask }} {
|
||||
{% if subnet.default_lease_time is defined %}
|
||||
default-lease-time {{ subnet.default_lease_time }};
|
||||
{% endif %}
|
||||
{% if subnet.max_lease_time is defined %}
|
||||
max-lease-time {{ subnet.max_lease_time }};
|
||||
{% endif %}
|
||||
{% if subnet.routers is defined %}
|
||||
option routers {{ subnet.routers }};
|
||||
{% endif %}
|
||||
{% if subnet.subnet_mask is defined %}
|
||||
option subnet-mask {{ subnet.subnet_mask }};
|
||||
{% endif %}
|
||||
{% if subnet.domain_search is defined %}
|
||||
{% if subnet.domain_search is string %}
|
||||
option domain-search "{{ subnet.domain_search }}";
|
||||
{% else %}
|
||||
option domain-search "{{ subnet.domain_search|join('", "') }}";
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if subnet.domain_name_servers is defined %}
|
||||
{% if subnet.domain_name_servers is string %}
|
||||
option domain-name-servers {{ subnet.domain_name_servers }};
|
||||
{% else %}
|
||||
option domain-name-servers {{ subnet.domain_name_servers|join(', ') }};
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if subnet.range_begin is defined and subnet.range_end is defined %}
|
||||
range {{ subnet.range_begin }} {{ subnet.range_end }};
|
||||
{% endif %}
|
||||
{% if subnet.ranges is defined %}
|
||||
{% for range in subnet.ranges %}
|
||||
range {{ range.begin }} {{ range.end }};
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if subnet.server_name is defined %}
|
||||
server-name {{ subnet.server_name }};
|
||||
{% endif %}
|
||||
{% if subnet.next_server is defined %}
|
||||
next-server {{ subnet.next_server }};
|
||||
{% endif %}
|
||||
{% if subnet.filename is defined %}
|
||||
filename "{{ subnet.filename }}";
|
||||
{% endif %}
|
||||
{% if subnet.bootp is defined %}
|
||||
{{ subnet.bootp }} bootp;
|
||||
{% endif %}
|
||||
{% if subnet.booting is defined %}
|
||||
{{ subnet.booting }} booting;
|
||||
{% endif %}
|
||||
{% if subnet.hosts is defined %}
|
||||
{% for host in subnet.hosts %}
|
||||
host {{ host.name }} {
|
||||
hardware ethernet {{ host.mac }};
|
||||
fixed-address {{ host.ip }};
|
||||
}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if subnet.pools is defined %}
|
||||
# Address pool(s)
|
||||
{% for pool in subnet.pools %}
|
||||
pool {
|
||||
{% if pool.failover_peer is defined %}
|
||||
# This pool has failover, see above for server details
|
||||
failover peer "{{ pool.failover_peer }}";
|
||||
{% endif %}
|
||||
{% if pool.domain_name_servers is defined %}
|
||||
{% if pool.domain_name_servers is string %}
|
||||
option domain-name-servers {{ pool.domain_name_servers }};
|
||||
{% else %}
|
||||
option domain-name-servers {{ pool.domain_name_servers|join(', ') }};
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if pool.default_lease_time is defined %}
|
||||
default-lease-time {{ pool.default_lease_time }};
|
||||
{% endif %}
|
||||
{% if pool.min_lease_time is defined %}
|
||||
min-lease-time {{ pool.min_lease_time }};
|
||||
{% endif %}
|
||||
{% if pool.max_lease_time is defined %}
|
||||
max-lease-time {{ pool.max_lease_time }};
|
||||
{% endif %}
|
||||
{% if pool.range_begin is defined and pool.range_end is defined %}
|
||||
range {{ pool.range_begin }} {{ pool.range_end }};
|
||||
{% endif %}
|
||||
{% if pool.allow is defined %}
|
||||
allow {{ pool.allow }};
|
||||
{% endif %}
|
||||
{% if pool.deny is defined %}
|
||||
deny {{ pool.deny }};
|
||||
{% endif %}
|
||||
}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
}
|
||||
{% endfor %}
|
||||
{% if dhcp_hosts is defined %}
|
||||
|
||||
#
|
||||
# Host declarations
|
||||
#
|
||||
{% for host in dhcp_hosts %}
|
||||
host {{ host.name | replace (" ","_") | replace ("'","_") | replace (":","_") }} {
|
||||
hardware ethernet {{ host.mac }};
|
||||
{% if host.ip is defined %}
|
||||
fixed-address {{ host.ip }};
|
||||
{% endif %}
|
||||
}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if dhcp_pxeboot_server is defined %}
|
||||
|
||||
#
|
||||
# PXEBoot server settings
|
||||
#
|
||||
option arch code 93 = unsigned integer 16; # RFC4578
|
||||
|
||||
class "pxeclients" {
|
||||
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
|
||||
next-server {{ dhcp_pxeboot_server }};
|
||||
|
||||
if option arch = 00:07 {
|
||||
filename "pxelinux/bootx64.efi";
|
||||
} else {
|
||||
filename "pxelinux/pxelinux.0";
|
||||
}
|
||||
}
|
||||
|
||||
{% endif %}
|
||||
@@ -1,11 +0,0 @@
|
||||
# roles/dhcp/vars/RedHat.yml
|
||||
---
|
||||
|
||||
dhcp_packages:
|
||||
- dhcp
|
||||
|
||||
dhcp_config_dir: /etc/dhcp
|
||||
|
||||
dhcp_config: /etc/dhcp/dhcpd.conf
|
||||
|
||||
dhcp_service: dhcpd
|
||||
Reference in New Issue
Block a user