aboutsummaryrefslogtreecommitdiff
path: root/iso.yml
blob: d3cc90ef2d790451d842e11f8834c74b382b5fe9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
- hosts: all
  become: true
  gather_facts: false

  tasks:
    - name: Create /root/bootcblade-output folder
      ansible.builtin.file:
        path: "/root/bootcblade-output"
        state: directory
      tags: setup

    - name: Create files
      ansible.builtin.template:
        src: "{{ item.src }}"
        dest: "{{ item.dest }}"
      loop:
        - { src: "bootcblade.config.toml.j2", dest: "/root/bootcblade.config.toml" }
        - { src: "bootcblade.containerfile.j2", dest: "/root/bootcblade.containerfile" }
        - { src: "bootcblade-iso.sh.j2", dest: "/root/bootcblade-iso.sh" }
      tags: setup

    - name: Build BootcBlade container image
      ansible.builtin.shell: "podman build -t localhost/bootcblade -f /root/bootcblade.containerfile"
      tags: build-container

    - name: Create BootcBlade ISO
      ansible.builtin.shell: "bash /root/bootcblade-iso.sh"
      tags: build-iso

    - name: Cleanup files
      ansible.builtin.file:
        path: "{{ item }}"
        state: absent
      loop:
        - "/root/bootcblade.config.toml"
        - "/root/bootcblade.containerfile"
        - "/root/bootcblade-iso.sh"
      tags: cleanup

    - name: Cleanup images
      ansible.builtin.shell: "podman image rm localhost/bootcblade ; podman image rm quay.io/centos-bootc/bootc-image-builder ; podman image rm quay.io/fedora/fedora-bootc:{{ bootc_image_tag if bootc_image_tag is defined else 'latest' }} ; podman image prune -f"
      tags: cleanup