From 6992116da58d4fab61014975986943aba36c47a4 Mon Sep 17 00:00:00 2001 From: ePietry Date: Thu, 28 Mar 2024 17:40:47 +0100 Subject: [PATCH] Update gen_iso_image --- ansible/playbooks/gen_iso_image.yaml | 36 +++++++++------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/ansible/playbooks/gen_iso_image.yaml b/ansible/playbooks/gen_iso_image.yaml index ab52ea8..550e797 100644 --- a/ansible/playbooks/gen_iso_image.yaml +++ b/ansible/playbooks/gen_iso_image.yaml @@ -2,18 +2,18 @@ hosts: all vars_files: ../credentials.yaml tasks: - - name: Clear /tmp/microshift_bluprint + - name: Clear /tmp/microshift_bluprint.toml ansible.builtin.file: path: /tmp/microshift_bluprint.toml state: absent - - name: Create /tmp/microshift_bluprint + - name: Create /tmp/microshift_bluprint.toml ansible.builtin.file: path: /tmp/microshift_bluprint.toml state: file mode: "0755" - name: Write blueprint content to /tmp/microshift_bluprint file ansible.builtin.copy: - dest: "/tmp/microshift_blueprint" + dest: "/tmp/microshift_blueprint.toml" content: | name = "microshift-installer" @@ -29,27 +29,13 @@ infra.osbuild.push_blueprint: src: "/tmp/microshift_blueprint.toml" - - name: Start the compose - ansible.builtin.shell: | - BUILDID=$(composer-cli compose start-ostree --url {{ repo_url }} --ref {{ ostree_ref }} {{ blueprint_name }} {{ compose_type }} | awk '{print $2}') - echo $BUILDID > /tmp/build_id - args: - executable: /bin/bash - register: start_compose_result - - - name: Wait for compose to finish (simplified example) - ansible.builtin.shell: | - BUILDID=$(cat /tmp/build_id) - until composer-cli compose status | grep -E "$BUILDID.*FINISHED"; do - sleep 30 - done - args: - executable: /bin/bash - - - name: Get BUILDID from file - ansible.builtin.shell: "cat /tmp/build_id" + - name: Start OSTree Compose + ansible.builtin.shell: + cmd: composer-cli compose start-ostree --url http://{{ ansible_default_ipv4.address }}/repo --ref empty microshift-installer edge-installer | awk '{print $2}' register: build_id - - name: Generate image from the compose - ansible.builtin.command: - cmd: "composer-cli compose image {{ build_id.stdout }}" + + - name: Wait for compose to finish + infra.osbuild.wait_compose: + compose_id: "{{build_id.stdout_lines | first}}" + timeout: 3600