- name: Create the initial ostree repo hosts: all become: true vars_files: ../config.yaml tasks: - name: Create Blueprint /tmp/blueprints repo ansible.builtin.file: path: /tmp/blueprints mode: '0755' state: directory - name: Copy Blueprint file to /tmp/blueprints ansible.builtin.copy: src: "{{ playbook_dir }}/../blueprints/{{ blueprint }}" dest: /tmp/blueprints/blueprint.toml mode: '0755' - name: Reading Blueprint file ansible.builtin.slurp: src: /tmp/blueprints/blueprint.toml register: toml_file_content - name: Getting Blueprint Name 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: "{{ blueprint_name.stdout }}" allow_duplicate: true register: builder_compose_start_out - name: Wait for compose to finish infra.osbuild.wait_compose: compose_id: "{{ builder_compose_start_out['result']['body']['build_id'] }}" timeout: 3600 - name: Create /tmp/images repo ansible.builtin.file: path: /tmp/images/ mode: '0755' state: directory - name: Export the compose artifact to /tmp/images infra.osbuild.export_compose: # noqa only-builtins compose_id: "{{ builder_compose_start_out['result']['body']['build_id'] }}" dest: /tmp/images/{{ builder_compose_start_out['result']['body']['build_id'] }}.tar - name: Clear directory /var/www/repo ansible.builtin.file: path: /var/www/repo state: absent - name: Extract compose artifact into /var/www/repo ansible.builtin.unarchive: 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: optimizing 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