From 8928243afa042fb56435d7d0824c07c531918784 Mon Sep 17 00:00:00 2001 From: ePietry Date: Tue, 26 Mar 2024 18:38:48 +0100 Subject: [PATCH] Fix Blueprint bug --- ansible/playbooks/initial_ostree.yaml | 30 +++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/ansible/playbooks/initial_ostree.yaml b/ansible/playbooks/initial_ostree.yaml index 887409d..ac589f2 100755 --- a/ansible/playbooks/initial_ostree.yaml +++ b/ansible/playbooks/initial_ostree.yaml @@ -2,22 +2,29 @@ hosts: all become: true tasks: - - name: Create blueprint repo + - name: Create Blueprint /tmp/blueprints repo ansible.builtin.file: path: /tmp/blueprints mode: '0755' state: directory - - name: Copy blueprint file + - name: Copy Blueprint file to /tmp/blueprints ansible.builtin.copy: src: "{{ playbook_dir }}/../blueprints/{{ blueprint }}" dest: /tmp/blueprints/blueprint.toml mode: '0755' - - name: Push a blueprint + - name: Read the content of the TOML file + ansible.builtin.slurp: + src: /tmp/blueprints/blueprint.toml + register: toml_file_content + - name: Parse TOML content using Python + ansible.builtin.shell: "echo '{{ toml_file_content.content | b64decode }}' | python -c 'import sys, toml; print(toml.loads(sys.stdin.read())[\"name\"])'" + register: blueprint_name + - name: Push Blueprint infra.osbuild.push_blueprint: src: "/tmp/blueprints/blueprint.toml" - name: Start ostree compose infra.osbuild.start_compose: - blueprint: rhel-edge-blueprint + blueprint: "{{ blueprint_name.stdout }}" allow_duplicate: true register: builder_compose_start_out - name: Wait for compose to finish @@ -42,3 +49,18 @@ src: /tmp/images/{{ builder_compose_start_out['result']['body']['build_id'] }}.tar dest: /var/www/ remote_src: true + - name: adding /var/www/repo to OSTree + ansible.builtin.shell: "ostree --repo=/var/www/repo refs" + - name: Create /tmp/empty-tree repo + ansible.builtin.file: + path: /tmp/empty-tree + mode: '0755' + state: directory + - name: optimazing OSTree + ansible.builtin.shell: "ostree --repo=/var/www/repo commit -b 'empty' --tree=dir=/tmp/empty-tree" + - name: adding /var/www/repo to OSTree + ansible.builtin.shell: "ostree --repo=/var/www/repo refs" + - name: Clear directory /tmp/images/ + ansible.builtin.file: + path: /tmp/images/ + state: absent