Browse Source

Update gen_iso_image

ca-cert-and-multi-ks
ePietry 2 years ago
parent
commit
6992116da5
  1. 36
      ansible/playbooks/gen_iso_image.yaml

36
ansible/playbooks/gen_iso_image.yaml

@ -2,18 +2,18 @@
hosts: all hosts: all
vars_files: ../credentials.yaml vars_files: ../credentials.yaml
tasks: tasks:
- name: Clear /tmp/microshift_bluprint - name: Clear /tmp/microshift_bluprint.toml
ansible.builtin.file: ansible.builtin.file:
path: /tmp/microshift_bluprint.toml path: /tmp/microshift_bluprint.toml
state: absent state: absent
- name: Create /tmp/microshift_bluprint - name: Create /tmp/microshift_bluprint.toml
ansible.builtin.file: ansible.builtin.file:
path: /tmp/microshift_bluprint.toml path: /tmp/microshift_bluprint.toml
state: file state: file
mode: "0755" mode: "0755"
- name: Write blueprint content to /tmp/microshift_bluprint file - name: Write blueprint content to /tmp/microshift_bluprint file
ansible.builtin.copy: ansible.builtin.copy:
dest: "/tmp/microshift_blueprint" dest: "/tmp/microshift_blueprint.toml"
content: | content: |
name = "microshift-installer" name = "microshift-installer"
@ -29,27 +29,13 @@
infra.osbuild.push_blueprint: infra.osbuild.push_blueprint:
src: "/tmp/microshift_blueprint.toml" src: "/tmp/microshift_blueprint.toml"
- name: Start the compose - name: Start OSTree Compose
ansible.builtin.shell: | ansible.builtin.shell:
BUILDID=$(composer-cli compose start-ostree --url {{ repo_url }} --ref {{ ostree_ref }} {{ blueprint_name }} {{ compose_type }} | awk '{print $2}') cmd: composer-cli compose start-ostree --url http://{{ ansible_default_ipv4.address }}/repo --ref empty microshift-installer edge-installer | 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"
register: build_id register: build_id
- name: Generate image from the compose
ansible.builtin.command: - name: Wait for compose to finish
cmd: "composer-cli compose image {{ build_id.stdout }}" infra.osbuild.wait_compose:
compose_id: "{{build_id.stdout_lines | first}}"
timeout: 3600

Loading…
Cancel
Save