2022-10-21 23:53:13 +07:00
- name : Get Docker info
docker_host_info : {}
register : docker_info_result
- name : Ensure Docker is running on a supported operating system
fail :
msg : Docker host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac or Windows (you can use a Linux VM with bridged networking instead)
when :
- docker_info_result.host_info.OperatingSystem == "Docker Desktop"
2022-03-06 14:47:32 +07:00
- name : Download boot image
2022-05-14 21:24:39 +07:00
ansible.builtin.get_url :
2021-03-03 01:56:33 +07:00
url : "{{ iso_url }}"
2021-08-31 02:11:33 +07:00
dest : "{{ role_path }}/files/data/iso/{{ iso_url | basename }}"
2021-04-21 21:30:23 +07:00
checksum : "{{ iso_checksum }}"
2022-05-14 21:24:39 +07:00
mode : 0644
2021-05-16 15:10:23 +07:00
register : iso
2021-03-03 01:25:56 +07:00
2022-03-06 14:47:32 +07:00
- name : Extract boot image
2022-05-14 21:24:39 +07:00
ansible.builtin.command :
2021-08-31 02:11:33 +07:00
cmd : "xorriso -osirrox on -indev {{ iso.dest }} -extract / {{ role_path }}/files/data/os"
creates : "{{ role_path }}/files/data/os/.treeinfo"
2021-03-03 01:25:56 +07:00
2022-07-18 01:39:02 +07:00
- name : Generate dnsmasq config
2022-05-14 21:24:39 +07:00
ansible.builtin.template :
2022-07-18 01:39:02 +07:00
src : dnsmasq.conf.j2
dest : "{{ role_path }}/files/data/pxe-config/dnsmasq.conf"
2021-12-26 12:12:36 +07:00
mode : 0644
2021-03-03 01:25:56 +07:00
2022-03-06 14:47:32 +07:00
- name : Generate GRUB config
2022-05-14 21:24:39 +07:00
ansible.builtin.template :
2021-08-31 02:11:33 +07:00
src : grub.cfg.j2
2021-08-31 05:11:42 +07:00
dest : "{{ role_path }}/files/data/pxe-config/grub.cfg"
2021-12-26 12:12:36 +07:00
mode : 0644
2021-08-31 02:11:33 +07:00
2022-03-06 14:47:32 +07:00
- name : Generate init config for each machine
2022-05-14 21:24:39 +07:00
ansible.builtin.template :
2021-08-31 02:11:33 +07:00
src : kickstart.ks.j2
dest : "{{ role_path }}/files/data/init-config/{{ hostvars[item]['mac'] }}.ks"
2021-12-26 12:12:36 +07:00
mode : 0644
2021-08-31 02:11:33 +07:00
loop : "{{ groups['metal'] }}"
2021-03-03 01:25:56 +07:00
2022-03-06 14:47:32 +07:00
- name : Start the ephemeral PXE server
2022-05-14 21:24:39 +07:00
community.docker.docker_compose :
2021-08-31 02:11:33 +07:00
project_src : "{{ role_path }}/files"
2021-03-03 01:25:56 +07:00
state : present
2021-12-26 12:12:36 +07:00
build : true