diff options
| author | spmfox <spmfox@foxwd.com> | 2024-05-28 15:27:24 -0400 |
|---|---|---|
| committer | spmfox <spmfox@foxwd.com> | 2024-05-28 15:27:24 -0400 |
| commit | 898d4673219d16a5dc19e523f94eba952365f0c1 (patch) | |
| tree | 1065b5713876e4e0d6f2923412fbb5623df10b0f | |
| parent | db610a23f49958d98858705f20fd63208d7937c9 (diff) | |
removing the base centos-bootc deployment, it caused problems with the final deployed image and did not save disk space
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | deploy.yml | 52 | ||||
| -rw-r--r-- | templates/bootcblade-deploy.sh.j2 (renamed from templates/centos-bootc-deploy.sh.j2) | 2 |
3 files changed, 25 insertions, 33 deletions
@@ -35,8 +35,8 @@ This Ansible automation uses bootc to create "the perfect" KVM hypervisor with Z ## How It Works ### Deploy 1. A new or existing system must exist. This system should be as small as possible because its filesystem will persist in the resulting deployed machine -2. A "base" centos-bootc is used for the first deploy - the user SSH key is set for the root user now -3. Once the base is deployed, we use that to build and ```bootc switch``` into the final BootcBlade image +2. ```bootcblade.containerfile``` is copied to the existing system, then ```podman build``` is used to build the image +3. Once the image is built, the BootcBlade image is deployed to the system - then it is rebooted 4. Ansible creates the user with (or without) the password and adds the SSH key ### ISO @@ -5,12 +5,20 @@ ansible_ssh_common_args: "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" tasks: - - name: Block for deploy-base-bootc + - name: Block for deploy block: - - name: Create /root/centos-bootc-deploy.sh + - name: Make sure podman is installed + ansible.builtin.package: + name: "podman" + state: present + + - name: Create /root/bootcblade.containerfile and /root/bootcblade-deploy.sh ansible.builtin.template: - src: "centos-bootc-deploy.sh.j2" - dest: "/root/centos-bootc-deploy.sh" + src: "{{ item }}.j2" + dest: "/root/{{ item }}" + loop: + - bootcblade.containerfile + - bootcblade-deploy.sh - name: Create root ssh authorized keys ansible.posix.authorized_key: @@ -18,39 +26,23 @@ key: "{{ create_user_ssh_pub }}" state: present - - name: Run bootc deployment for basic centos-bootc environment - ansible.builtin.shell: "bash /root/centos-bootc-deploy.sh" - - - name: Reboot into basic centos-bootc environment - ansible.builtin.reboot: - reboot_timeout: 1 - ignore_errors: true - tags: deploy-base-bootc - - - name: Block for deploy-bootcblade - block: - - name: Wait for connectivity to basic centos-bootc environment - ansible.builtin.wait_for_connection: - - - name: Create /root/BootcBlade.containerfile - ansible.builtin.template: - src: "bootcblade.containerfile.j2" - dest: "/root/bootcblade.containerfile" - - name: Build BootcBlade container image ansible.builtin.shell: "podman build -t localhost/bootcblade -f /root/bootcblade.containerfile" - - name: Run bootc-switch into BootcBlade image - ansible.builtin.shell: "bootc switch --transport containers-storage localhost/bootcblade:latest" + - name: Deploy BootcBlade image + ansible.builtin.shell: "bash /root/bootcblade-deploy.sh" - name: Reboot into BootcBlade environment ansible.builtin.reboot: - vars: - ansible_user: "root" - tags: deploy-bootcblade + reboot_timeout: 1 + ignore_errors: true + tags: deploy - - name: Block for configure-bootcblade + - name: Block for configure block: + - name: Wait for connectivity after deployment + ansible.builtin.wait_for_connection: + - name: Create user ansible.builtin.user: name: "{{ create_user }}" @@ -105,5 +97,5 @@ - "bootc-fetch-apply-updates.service" vars: ansible_user: "root" - tags: configure-bootcblade + tags: configure diff --git a/templates/centos-bootc-deploy.sh.j2 b/templates/bootcblade-deploy.sh.j2 index 2083295..ecd91e3 100644 --- a/templates/centos-bootc-deploy.sh.j2 +++ b/templates/bootcblade-deploy.sh.j2 @@ -5,5 +5,5 @@ podman run --rm --privileged \ --volume /var/lib/containers:/var/lib/containers \ --volume /:/target \ --entrypoint bootc \ - quay.io/centos-bootc/centos-bootc:{{ centos_bootc_tag if centos_bootc_tag is defined else 'stream9' }} \ + localhost/bootcblade:latest \ install to-filesystem --skip-fetch-check --replace=alongside /target --root-ssh-authorized-keys /target/root/.ssh/authorized_keys {{ '' if bootc_acknowledge is false else '--acknowledge-destructive' }} |
