diff --git a/ansible/build-iso.yaml b/ansible/build-iso.yaml new file mode 100644 index 0000000..f693ada --- /dev/null +++ b/ansible/build-iso.yaml @@ -0,0 +1,30 @@ +- debug: + msg: "Injecting Kickstart of {{ device.hostname }} into ISO..." + +- name: Create kiosk.ks from template + ansible.builtin.template: + src: "kiosk.ks.j2" + dest: "{{ tmp.path }}/kiosk-{{ device.hostname }}.ks" + +- name: Validate kiosk.ks using ksvalidator + ansible.builtin.command: + cmd: "ksvalidator {{ tmp.path }}/kiosk-{{ device.hostname }}.ks" + +- name: Create new kiosk.iso file + ansible.builtin.command: + cmd: "mkksiso -r 'inst.ks' --ks {{ tmp.path }}/kiosk-{{ device.hostname }}.ks {{ tmp.path }}/{{ compose_id }}.iso {{ tmp.path }}/kiosk.iso" + +- name: Copy new ISO to /var/www + copy: + src: "{{ tmp.path }}/kiosk.iso" + dest: "{{ www_location }}/kiosk-{{ device.hostname }}.iso" + remote_src: true + become: true + +- name: Cleanup + ansible.builtin.file: + path: '{{ item }}' + state: absent + loop: + - "{{ tmp.path }}/kiosk.iso" + - "{{ tmp.path }}/kiosk-{{ device.hostname }}.ks" diff --git a/ansible/build.yaml b/ansible/build.yaml index 306df34..a96c30c 100644 --- a/ansible/build.yaml +++ b/ansible/build.yaml @@ -257,25 +257,11 @@ compose_id: "{{ compose_id }}" dest: "{{ tmp.path }}/{{ compose_id }}.iso" - - name: Create kiosk.ks from template - ansible.builtin.template: - src: "kiosk.ks.j2" - dest: "{{ tmp.path }}/kiosk.ks" - - - name: Validate kiosk.ks using ksvalidator - ansible.builtin.command: - cmd: "ksvalidator {{ tmp.path }}/kiosk.ks" - - - name: Create new kiosk.iso file - ansible.builtin.command: - cmd: "mkksiso -r 'inst.ks' --ks {{ tmp.path }}/kiosk.ks {{ tmp.path }}/{{ compose_id }}.iso {{ tmp.path }}/kiosk.iso" - - - name: Copy new ISO to /var/www - copy: - src: "{{ tmp.path }}/kiosk.iso" - dest: "{{ www_location }}/kiosk.iso" - remote_src: true - become: true + - ansible.builtin.include_tasks: build-iso.yaml + loop: '{{ kickstart_devices }}' + loop_control: + label: "{{ device.hostname }}" + loop_var: device post_tasks: - ansible.builtin.file: diff --git a/ansible/group_vars/all/config.yaml b/ansible/group_vars/all/config.yaml index 6ae268f..6e75911 100644 --- a/ansible/group_vars/all/config.yaml +++ b/ansible/group_vars/all/config.yaml @@ -2,4 +2,3 @@ repo_location: /opt/custom-rpms blueprint_admin_ssh_public_key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFW62WJXI1ZCMfNA4w0dMpL0fsldhbEfULNGIUB0nQui nmasse@localhost.localdomain www_location: /var/www compose_timeout: 300 -kickstart_root_disk: /dev/disk/by-path/pci-0000:00:12.0-ata-1 diff --git a/ansible/group_vars/all/devices.yaml b/ansible/group_vars/all/devices.yaml new file mode 100644 index 0000000..c3652ba --- /dev/null +++ b/ansible/group_vars/all/devices.yaml @@ -0,0 +1,10 @@ +kickstart_devices: +- hostname: kiosk.localdomain + storage: + root_disk: /dev/disk/by-path/pci-0000:00:12.0-ata-1 + network: + interface: enp1s0 + ip_address: 192.168.122.23 + netmask: 255.255.255.0 + gateway: 192.168.122.1 + dns: 192.168.122.1 diff --git a/ansible/templates/kiosk.ks.j2 b/ansible/templates/kiosk.ks.j2 index 7ffd110..9038341 100644 --- a/ansible/templates/kiosk.ks.j2 +++ b/ansible/templates/kiosk.ks.j2 @@ -27,7 +27,7 @@ text zerombr clearpart --all --initlabel reqpart --add-boot -part pv.01 --size=1024 --grow --ondisk={{ kickstart_root_disk }} +part pv.01 --size=1024 --grow --ondisk={{ device.storage.root_disk }} volgroup rhel pv.01 logvol / --fstype="xfs" --size=10240 --name=root --vgname=rhel @@ -36,10 +36,10 @@ logvol / --fstype="xfs" --size=10240 --name=root --vgname=rhel ## # Configure the first network device -network --bootproto=dhcp --device=enp1s0 --noipv6 --activate +network --bootproto=static --ip={{ device.network.ip_address }} --netmask={{ device.network.netmask }} --gateway={{ device.network.gateway }} --nameserver={{ device.network.dns }} --device={{ device.network.interface }} --noipv6 --activate # Configure hostname -network --hostname=kiosk.localdomain +network --hostname={{ device.hostname }} ## ## Ostree installation