2024-09-19 13:29:35 +03:00

22 lines
785 B
YAML

---
- name: Copy from template boot.ipxe
ansible.builtin.template:
src: boot.ipxe.j2
dest: "{{ path_ipxe_boot }}/boot_{{ vm_macaddress }}.ipxe"
- name: Copy from template preseed.cfg
ansible.builtin.template:
src: preseed.cfg.j2
dest: "{{ path_preseed }}/preseed_{{ vm_macaddress }}.cfg"
- name: Add config to DHCP server
ansible.builtin.lineinfile:
path: "{{ path_dhcp_conf }}"
line: 'host {{ vm_name | regex_replace("\..*","") }} { hardware ethernet {{ vm_macaddress }}; if exists user-class and option user-class = "iPXE" { filename "http://${next-server}:80/.boot/boot_{{ vm_macaddress }}.ipxe";} else { filename "undionly.kpxe"; }}'
- name: Restart DHCP service
ansible.builtin.systemd_service:
state: restarted
name: isc-dhcp-server