diff --git a/ansible/README.MD b/ansible/README.MD index 5ea5ac4..33a5272 100644 --- a/ansible/README.MD +++ b/ansible/README.MD @@ -101,6 +101,7 @@ blueprint: #name of the blueprint you want to use from the ansible/bluprint fold repo_location: #EXAMPLE repo_location: /opt/custom-rpms/ ADMIN_SSH_PUBLIC_KEY: # ssh-rsa AA... ADMIN_PASSWORD: +MICROSHIFT_PULL_SECRET: # Generate one on https://console.redhat.com/openshift/install/pull-secret ``` diff --git a/ansible/playbooks/ostree_construction.yaml b/ansible/playbooks/ostree_construction.yaml new file mode 100644 index 0000000..2ba203e --- /dev/null +++ b/ansible/playbooks/ostree_construction.yaml @@ -0,0 +1,66 @@ +- name: Create the initial ostree repo + hosts: all + vars_files: ../credentials.yaml + tasks: + - name: Solve dependencies for the blueprint + ansible.builtin.command: composer-cli blueprints depsolve kiosk + + + - name: Start ostree compose + infra.osbuild.start_compose: + blueprint: kiosk + compose_type: edge-commit + allow_duplicate: true + ostree_url: http://{{ ansible_default_ipv4.address }}/repo + 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/commit repo + ansible.builtin.file: + path: /tmp/commit/ + mode: '0755' + state: directory + + - name: Export the compose artifact to /tmp/commit + infra.osbuild.export_compose: # noqa only-builtins + compose_id: "{{ builder_compose_start_out['result']['body']['build_id'] }}" + dest: /tmp/commit/{{ builder_compose_start_out['result']['body']['build_id'] }}.tar + + - name: Create /tmp/commit/ID repo + ansible.builtin.file: + path: /tmp/commit/{{ builder_compose_start_out['result']['body']['build_id'] }} + mode: '0755' + state: directory + + + - name: Extract compose artifact into /var/www/repo + ansible.builtin.unarchive: + src: /tmp/commit/{{ builder_compose_start_out['result']['body']['build_id'] }}.tar + dest: /tmp/commit/{{ builder_compose_start_out['result']['body']['build_id'] }} + remote_src: true + + - name: Pull local ostree repository + become: true + ansible.builtin.shell: ostree --repo=/var/www/repo pull-local "/tmp/commit/{{ builder_compose_start_out['result']['body']['build_id'] }}/repo" + + - name: config ostree ref + become: true + ansible.builtin.shell: ostree --repo=/var/www/repo refs + register: refs + + - name: Print refs + ansible.builtin.debug: + var: refs.stdout_lines + + - name: config ostree logs kiosk + become: true + ansible.builtin.shell: ostree --repo=/var/www/repo log rhel/9/x86_64/edge + register: logs + + - name: Print refs + ansible.builtin.debug: + var: logs.stdout_lines