From caf10019e27e4612bf3514eadd02f11e88449fee Mon Sep 17 00:00:00 2001 From: Patrick Toal Date: Tue, 29 Jun 2021 22:10:31 -0400 Subject: [PATCH] Update roles --- .../meta/.galaxy_install_info | 2 +- .../meta/.galaxy_install_info | 2 +- .../meta/.galaxy_install_info | 2 +- .../meta/.galaxy_install_info | 2 +- .../meta/.galaxy_install_info | 2 +- .../meta/.galaxy_install_info | 2 +- .../meta/.galaxy_install_info | 2 +- roles/oatakan.rhel_ovirt_template/README.md | 4 +- .../defaults/main.yml | 38 +-- .../meta/.galaxy_install_info | 2 +- .../tasks/datastore_upload.yml | 2 +- .../tasks/make_iso.yml | 4 +- .../oatakan.rhel_ovirt_template/vars/main.yml | 6 +- .../files/growpart.service | 12 + .../meta/.galaxy_install_info | 2 +- .../tasks/grow_part.yml | 25 ++ .../tasks/main.yml | 3 + .../meta/.galaxy_install_info | 2 +- .../oatakan.windows_ovirt_template/README.md | 2 +- .../defaults/main.yml | 18 +- .../meta/.galaxy_install_info | 2 +- .../tasks/datastore_upload.yml | 2 +- .../tasks/make_iso.yml | 4 +- .../tasks/virtio_drivers.yml | 4 +- .../windows_server/Autounattend.xml.j2 | 38 ++- .../vars/main.yml | 2 +- .../meta/.galaxy_install_info | 2 +- .../tasks/compact.yml | 4 +- .../tasks/enable_powershell.yml | 32 ++ .../tasks/enable_tls_system_default.yml | 4 +- .../tasks/powershell-upgrade.yml | 2 + .../tasks/winrm-memfix.yml | 2 +- .../meta/.galaxy_install_info | 2 +- .../meta/.galaxy_install_info | 2 +- roles/requirements.yml | 4 +- roles/sage905.dhcp/.gitignore | 13 - roles/sage905.dhcp/.yamllint | 21 -- roles/sage905.dhcp/README.md | 233 -------------- roles/sage905.dhcp/defaults/main.yml | 5 - roles/sage905.dhcp/handlers/main.yml | 7 - roles/sage905.dhcp/meta/.galaxy_install_info | 2 - roles/sage905.dhcp/meta/main.yml | 17 - roles/sage905.dhcp/tasks/main.yml | 50 --- .../templates/etc_dhcp_dhcpd.conf.j2 | 296 ------------------ roles/sage905.dhcp/vars/RedHat.yml | 11 - 45 files changed, 156 insertions(+), 739 deletions(-) create mode 100644 roles/oatakan.rhel_template_build/files/growpart.service create mode 100644 roles/oatakan.rhel_template_build/tasks/grow_part.yml create mode 100644 roles/oatakan.windows_template_build/tasks/enable_powershell.yml delete mode 100644 roles/sage905.dhcp/.gitignore delete mode 100644 roles/sage905.dhcp/.yamllint delete mode 100644 roles/sage905.dhcp/README.md delete mode 100644 roles/sage905.dhcp/defaults/main.yml delete mode 100644 roles/sage905.dhcp/handlers/main.yml delete mode 100644 roles/sage905.dhcp/meta/.galaxy_install_info delete mode 100644 roles/sage905.dhcp/meta/main.yml delete mode 100644 roles/sage905.dhcp/tasks/main.yml delete mode 100644 roles/sage905.dhcp/templates/etc_dhcp_dhcpd.conf.j2 delete mode 100644 roles/sage905.dhcp/vars/RedHat.yml diff --git a/roles/geerlingguy.gitlab/meta/.galaxy_install_info b/roles/geerlingguy.gitlab/meta/.galaxy_install_info index edaf9d9..e2f8f49 100644 --- a/roles/geerlingguy.gitlab/meta/.galaxy_install_info +++ b/roles/geerlingguy.gitlab/meta/.galaxy_install_info @@ -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 diff --git a/roles/geerlingguy.java/meta/.galaxy_install_info b/roles/geerlingguy.java/meta/.galaxy_install_info index 76daa9a..8bb584f 100644 --- a/roles/geerlingguy.java/meta/.galaxy_install_info +++ b/roles/geerlingguy.java/meta/.galaxy_install_info @@ -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 diff --git a/roles/ikke_t.container_image_cleanup/meta/.galaxy_install_info b/roles/ikke_t.container_image_cleanup/meta/.galaxy_install_info index a391211..e3790ed 100644 --- a/roles/ikke_t.container_image_cleanup/meta/.galaxy_install_info +++ b/roles/ikke_t.container_image_cleanup/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Wed May 5 16:14:11 2021 +install_date: Wed Jun 30 01:12:56 2021 version: master diff --git a/roles/ikke_t.podman_container_systemd/meta/.galaxy_install_info b/roles/ikke_t.podman_container_systemd/meta/.galaxy_install_info index daa18ac..877d2c3 100644 --- a/roles/ikke_t.podman_container_systemd/meta/.galaxy_install_info +++ b/roles/ikke_t.podman_container_systemd/meta/.galaxy_install_info @@ -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 diff --git a/roles/linux-system-roles.network/meta/.galaxy_install_info b/roles/linux-system-roles.network/meta/.galaxy_install_info index 79ec4b4..cae0cfc 100644 --- a/roles/linux-system-roles.network/meta/.galaxy_install_info +++ b/roles/linux-system-roles.network/meta/.galaxy_install_info @@ -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 diff --git a/roles/oatakan.ansible-role-ovirt/meta/.galaxy_install_info b/roles/oatakan.ansible-role-ovirt/meta/.galaxy_install_info index 266e761..d8dccdf 100644 --- a/roles/oatakan.ansible-role-ovirt/meta/.galaxy_install_info +++ b/roles/oatakan.ansible-role-ovirt/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Wed May 5 16:14:07 2021 +install_date: Wed Jun 30 01:12:51 2021 version: '' diff --git a/roles/oatakan.ansible-role-windows-ad-controller/meta/.galaxy_install_info b/roles/oatakan.ansible-role-windows-ad-controller/meta/.galaxy_install_info index c1f24ae..03b2a7f 100644 --- a/roles/oatakan.ansible-role-windows-ad-controller/meta/.galaxy_install_info +++ b/roles/oatakan.ansible-role-windows-ad-controller/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Wed May 5 16:14:02 2021 +install_date: Wed Jun 30 01:12:47 2021 version: '' diff --git a/roles/oatakan.rhel_ovirt_template/README.md b/roles/oatakan.rhel_ovirt_template/README.md index 18deb9d..14fa258 100644 --- a/roles/oatakan.rhel_ovirt_template/README.md +++ b/roles/oatakan.rhel_ovirt_template/README.md @@ -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 diff --git a/roles/oatakan.rhel_ovirt_template/defaults/main.yml b/roles/oatakan.rhel_ovirt_template/defaults/main.yml index 78eb9a2..b0fb3fa 100644 --- a/roles/oatakan.rhel_ovirt_template/defaults/main.yml +++ b/roles/oatakan.rhel_ovirt_template/defaults/main.yml @@ -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 \ No newline at end of file diff --git a/roles/oatakan.rhel_ovirt_template/meta/.galaxy_install_info b/roles/oatakan.rhel_ovirt_template/meta/.galaxy_install_info index 588ecb9..cc1745b 100644 --- a/roles/oatakan.rhel_ovirt_template/meta/.galaxy_install_info +++ b/roles/oatakan.rhel_ovirt_template/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Wed May 5 16:14:09 2021 +install_date: Wed Jun 30 01:12:53 2021 version: master diff --git a/roles/oatakan.rhel_ovirt_template/tasks/datastore_upload.yml b/roles/oatakan.rhel_ovirt_template/tasks/datastore_upload.yml index 7670698..03082b3 100644 --- a/roles/oatakan.rhel_ovirt_template/tasks/datastore_upload.yml +++ b/roles/oatakan.rhel_ovirt_template/tasks/datastore_upload.yml @@ -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 diff --git a/roles/oatakan.rhel_ovirt_template/tasks/make_iso.yml b/roles/oatakan.rhel_ovirt_template/tasks/make_iso.yml index c4f178e..7603aeb 100644 --- a/roles/oatakan.rhel_ovirt_template/tasks/make_iso.yml +++ b/roles/oatakan.rhel_ovirt_template/tasks/make_iso.yml @@ -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/ \ No newline at end of file diff --git a/roles/oatakan.rhel_ovirt_template/vars/main.yml b/roles/oatakan.rhel_ovirt_template/vars/main.yml index 7f5ee3f..37585c5 100644 --- a/roles/oatakan.rhel_ovirt_template/vars/main.yml +++ b/roles/oatakan.rhel_ovirt_template/vars/main.yml @@ -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 diff --git a/roles/oatakan.rhel_template_build/files/growpart.service b/roles/oatakan.rhel_template_build/files/growpart.service new file mode 100644 index 0000000..fb23f71 --- /dev/null +++ b/roles/oatakan.rhel_template_build/files/growpart.service @@ -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 \ No newline at end of file diff --git a/roles/oatakan.rhel_template_build/meta/.galaxy_install_info b/roles/oatakan.rhel_template_build/meta/.galaxy_install_info index b14df6e..607a6b6 100644 --- a/roles/oatakan.rhel_template_build/meta/.galaxy_install_info +++ b/roles/oatakan.rhel_template_build/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Wed May 5 16:14:08 2021 +install_date: Wed Jun 30 01:12:52 2021 version: master diff --git a/roles/oatakan.rhel_template_build/tasks/grow_part.yml b/roles/oatakan.rhel_template_build/tasks/grow_part.yml new file mode 100644 index 0000000..e5d4ba7 --- /dev/null +++ b/roles/oatakan.rhel_template_build/tasks/grow_part.yml @@ -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 \ No newline at end of file diff --git a/roles/oatakan.rhel_template_build/tasks/main.yml b/roles/oatakan.rhel_template_build/tasks/main.yml index bea0758..84fca08 100644 --- a/roles/oatakan.rhel_template_build/tasks/main.yml +++ b/roles/oatakan.rhel_template_build/tasks/main.yml @@ -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 diff --git a/roles/oatakan.windows_ovirt_guest_agent/meta/.galaxy_install_info b/roles/oatakan.windows_ovirt_guest_agent/meta/.galaxy_install_info index 61eafda..35adf9d 100644 --- a/roles/oatakan.windows_ovirt_guest_agent/meta/.galaxy_install_info +++ b/roles/oatakan.windows_ovirt_guest_agent/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Wed May 5 16:14:04 2021 +install_date: Wed Jun 30 01:12:48 2021 version: master diff --git a/roles/oatakan.windows_ovirt_template/README.md b/roles/oatakan.windows_ovirt_template/README.md index be15ba2..9d68ecc 100644 --- a/roles/oatakan.windows_ovirt_template/README.md +++ b/roles/oatakan.windows_ovirt_template/README.md @@ -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 diff --git a/roles/oatakan.windows_ovirt_template/defaults/main.yml b/roles/oatakan.windows_ovirt_template/defaults/main.yml index 6ff1a85..b64a43c 100644 --- a/roles/oatakan.windows_ovirt_template/defaults/main.yml +++ b/roles/oatakan.windows_ovirt_template/defaults/main.yml @@ -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 \ No newline at end of file + win2008: 2k8R2 + win2012: 2k12R2 + win2016: 2k16 + win2019: 2k19 + win10: 10 \ No newline at end of file diff --git a/roles/oatakan.windows_ovirt_template/meta/.galaxy_install_info b/roles/oatakan.windows_ovirt_template/meta/.galaxy_install_info index 5a5ef88..3bd5051 100644 --- a/roles/oatakan.windows_ovirt_template/meta/.galaxy_install_info +++ b/roles/oatakan.windows_ovirt_template/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Wed May 5 16:14:00 2021 +install_date: Wed Jun 30 01:12:45 2021 version: '' diff --git a/roles/oatakan.windows_ovirt_template/tasks/datastore_upload.yml b/roles/oatakan.windows_ovirt_template/tasks/datastore_upload.yml index 556e8b9..5dbde3c 100644 --- a/roles/oatakan.windows_ovirt_template/tasks/datastore_upload.yml +++ b/roles/oatakan.windows_ovirt_template/tasks/datastore_upload.yml @@ -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 diff --git a/roles/oatakan.windows_ovirt_template/tasks/make_iso.yml b/roles/oatakan.windows_ovirt_template/tasks/make_iso.yml index 53bfc05..89242c1 100644 --- a/roles/oatakan.windows_ovirt_template/tasks/make_iso.yml +++ b/roles/oatakan.windows_ovirt_template/tasks/make_iso.yml @@ -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/ \ No newline at end of file diff --git a/roles/oatakan.windows_ovirt_template/tasks/virtio_drivers.yml b/roles/oatakan.windows_ovirt_template/tasks/virtio_drivers.yml index 62f5085..6b62380 100644 --- a/roles/oatakan.windows_ovirt_template/tasks/virtio_drivers.yml +++ b/roles/oatakan.windows_ovirt_template/tasks/virtio_drivers.yml @@ -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: > diff --git a/roles/oatakan.windows_ovirt_template/templates/windows_server/Autounattend.xml.j2 b/roles/oatakan.windows_ovirt_template/templates/windows_server/Autounattend.xml.j2 index 83de4f3..a5a1d5c 100644 --- a/roles/oatakan.windows_ovirt_template/templates/windows_server/Autounattend.xml.j2 +++ b/roles/oatakan.windows_ovirt_template/templates/windows_server/Autounattend.xml.j2 @@ -34,7 +34,7 @@ NTFS - + C 2 2 @@ -78,7 +78,7 @@ C 4 4 - + 0 @@ -158,7 +158,7 @@ true -{% if not '2008' in windows_distro_name %} +{% if not '2008' in distro_name %} true true true @@ -219,7 +219,7 @@ 1 true -{% if not '2008' in windows_distro_name %} +{% if not '2008' in distro_name %} cmd.exe /c powershell -Command "Set-NetConnectionProfile -NetworkCategory Private" Set network connection profile to private @@ -305,8 +305,32 @@ 15 true + + cmd.exe /c dism /online /enable-feature /featurename:NetFx2-ServerCore + Enable NetFx2-ServerCore feature + 16 + true + + + cmd.exe /c dism /online /enable-feature /featurename:NetFx2-ServerCore-WOW64 + Enable NetFx2-ServerCore feature + 17 + true + + + cmd.exe /c dism /online /enable-feature /featurename:MicrosoftWindowsPowerShell + Enable MicrosoftWindowsPowerShell feature + 18 + true + + + cmd.exe /c dism /online /enable-feature /featurename:ServerManager-PSH-Cmdlets + Enable ServerManager-PSH-Cmdlets feature + 19 + true + {% endif %} -{% if '2016' in windows_distro_name %} +{% if '2016' in distro_name %} cmd.exe /c reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SchUseStrongCrypto /t REG_DWORD /d 1 /reg:64 /f Configure security protocol @@ -333,7 +357,7 @@ true {% 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 %} 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" Set static ip @@ -349,7 +373,7 @@ {% endif %} {% if template.networks[0].dns_servers is defined %} -{% if not '2008' in windows_distro_name %} +{% if not '2008' in distro_name %} cmd.exe /c powershell -Command "Set-DNSClientServerAddress –InterfaceIndex (Get-NetAdapter).InterfaceIndex –ServerAddresses {{ template.networks[0].dns_servers|join(',') }}" Set static ip diff --git a/roles/oatakan.windows_ovirt_template/vars/main.yml b/roles/oatakan.windows_ovirt_template/vars/main.yml index 0049486..2464930 100644 --- a/roles/oatakan.windows_ovirt_template/vars/main.yml +++ b/roles/oatakan.windows_ovirt_template/vars/main.yml @@ -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 }}" diff --git a/roles/oatakan.windows_template_build/meta/.galaxy_install_info b/roles/oatakan.windows_template_build/meta/.galaxy_install_info index 10e6dc0..e2a9ac5 100644 --- a/roles/oatakan.windows_template_build/meta/.galaxy_install_info +++ b/roles/oatakan.windows_template_build/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Wed May 5 16:14:01 2021 +install_date: Wed Jun 30 01:12:46 2021 version: master diff --git a/roles/oatakan.windows_template_build/tasks/compact.yml b/roles/oatakan.windows_template_build/tasks/compact.yml index 4ad637b..8386d59 100644 --- a/roles/oatakan.windows_template_build/tasks/compact.yml +++ b/roles/oatakan.windows_template_build/tasks/compact.yml @@ -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 diff --git a/roles/oatakan.windows_template_build/tasks/enable_powershell.yml b/roles/oatakan.windows_template_build/tasks/enable_powershell.yml new file mode 100644 index 0000000..c77ef8e --- /dev/null +++ b/roles/oatakan.windows_template_build/tasks/enable_powershell.yml @@ -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) \ No newline at end of file diff --git a/roles/oatakan.windows_template_build/tasks/enable_tls_system_default.yml b/roles/oatakan.windows_template_build/tasks/enable_tls_system_default.yml index 99ff2dd..b6dce6f 100644 --- a/roles/oatakan.windows_template_build/tasks/enable_tls_system_default.yml +++ b/roles/oatakan.windows_template_build/tasks/enable_tls_system_default.yml @@ -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' diff --git a/roles/oatakan.windows_template_build/tasks/powershell-upgrade.yml b/roles/oatakan.windows_template_build/tasks/powershell-upgrade.yml index cb71db7..28a8c26 100644 --- a/roles/oatakan.windows_template_build/tasks/powershell-upgrade.yml +++ b/roles/oatakan.windows_template_build/tasks/powershell-upgrade.yml @@ -1,5 +1,7 @@ --- +- include_tasks: enable_powershell.yml + - include_tasks: enable_tls_system_default.yml - name: download script diff --git a/roles/oatakan.windows_template_build/tasks/winrm-memfix.yml b/roles/oatakan.windows_template_build/tasks/winrm-memfix.yml index e44cd8e..4fdb29c 100644 --- a/roles/oatakan.windows_template_build/tasks/winrm-memfix.yml +++ b/roles/oatakan.windows_template_build/tasks/winrm-memfix.yml @@ -40,7 +40,7 @@ - name: wait for system to reboot after fix wait_for_connection: - delay: 240 + delay: 300 sleep: 30 timeout: 300 diff --git a/roles/oatakan.windows_update/meta/.galaxy_install_info b/roles/oatakan.windows_update/meta/.galaxy_install_info index 027d0fb..ae3da43 100644 --- a/roles/oatakan.windows_update/meta/.galaxy_install_info +++ b/roles/oatakan.windows_update/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Wed May 5 16:14:06 2021 +install_date: Wed Jun 30 01:12:50 2021 version: master diff --git a/roles/oatakan.windows_virtio/meta/.galaxy_install_info b/roles/oatakan.windows_virtio/meta/.galaxy_install_info index 8d8783c..0ee7910 100644 --- a/roles/oatakan.windows_virtio/meta/.galaxy_install_info +++ b/roles/oatakan.windows_virtio/meta/.galaxy_install_info @@ -1,2 +1,2 @@ -install_date: Wed May 5 16:14:05 2021 +install_date: Wed Jun 30 01:12:49 2021 version: master diff --git a/roles/requirements.yml b/roles/requirements.yml index 4c6cb1e..4381880 100644 --- a/roles/requirements.yml +++ b/roles/requirements.yml @@ -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 diff --git a/roles/sage905.dhcp/.gitignore b/roles/sage905.dhcp/.gitignore deleted file mode 100644 index 0fb91c3..0000000 --- a/roles/sage905.dhcp/.gitignore +++ /dev/null @@ -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/ diff --git a/roles/sage905.dhcp/.yamllint b/roles/sage905.dhcp/.yamllint deleted file mode 100644 index d3f556e..0000000 --- a/roles/sage905.dhcp/.yamllint +++ /dev/null @@ -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 \ No newline at end of file diff --git a/roles/sage905.dhcp/README.md b/roles/sage905.dhcp/README.md deleted file mode 100644 index b6cde07..0000000 --- a/roles/sage905.dhcp/README.md +++ /dev/null @@ -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). diff --git a/roles/sage905.dhcp/defaults/main.yml b/roles/sage905.dhcp/defaults/main.yml deleted file mode 100644 index eb07550..0000000 --- a/roles/sage905.dhcp/defaults/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -# roles/dhcp/defaults/main.yml ---- -dhcp_global_includes_missing: false -dhcp_packages_state: "present" -dhcp_subnets: [] diff --git a/roles/sage905.dhcp/handlers/main.yml b/roles/sage905.dhcp/handlers/main.yml deleted file mode 100644 index 6938353..0000000 --- a/roles/sage905.dhcp/handlers/main.yml +++ /dev/null @@ -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') }}" diff --git a/roles/sage905.dhcp/meta/.galaxy_install_info b/roles/sage905.dhcp/meta/.galaxy_install_info deleted file mode 100644 index 3676d72..0000000 --- a/roles/sage905.dhcp/meta/.galaxy_install_info +++ /dev/null @@ -1,2 +0,0 @@ -install_date: Sun Jun 28 14:49:12 2020 -version: v3.0.1 diff --git a/roles/sage905.dhcp/meta/main.yml b/roles/sage905.dhcp/meta/main.yml deleted file mode 100644 index c204e8a..0000000 --- a/roles/sage905.dhcp/meta/main.yml +++ /dev/null @@ -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: [] diff --git a/roles/sage905.dhcp/tasks/main.yml b/roles/sage905.dhcp/tasks/main.yml deleted file mode 100644 index 2aadce5..0000000 --- a/roles/sage905.dhcp/tasks/main.yml +++ /dev/null @@ -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 diff --git a/roles/sage905.dhcp/templates/etc_dhcp_dhcpd.conf.j2 b/roles/sage905.dhcp/templates/etc_dhcp_dhcpd.conf.j2 deleted file mode 100644 index c0760ad..0000000 --- a/roles/sage905.dhcp/templates/etc_dhcp_dhcpd.conf.j2 +++ /dev/null @@ -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 %} diff --git a/roles/sage905.dhcp/vars/RedHat.yml b/roles/sage905.dhcp/vars/RedHat.yml deleted file mode 100644 index 0a4a8ae..0000000 --- a/roles/sage905.dhcp/vars/RedHat.yml +++ /dev/null @@ -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