generated from the-liberated-edge/wikijs
# Issue This PR implements the-liberated-edge/test_linux_containers#8 # Acceptance criteria - [x] The existing playbook has been amended, so that it creates and publishes container images to an incus server running locally. - [x] Container image name has been parameterised and provided as an Ansible variable. Co-authored-by: Emil <emil@theliberatededge.org> Reviewed-on: #22
23 lines
756 B
YAML
23 lines
756 B
YAML
---
|
|
- name: Find container image by name
|
|
ansible.builtin.command: incus image ls {{ lte_image_name }}
|
|
register: image_state
|
|
changed_when: false
|
|
- name: Remove an existing container image
|
|
ansible.builtin.shell:
|
|
cmd: incus image rm {{ lte_image_name }}
|
|
when: >
|
|
lte_image_state == 'absent' and
|
|
'results' in image_state and
|
|
image_state.results[0].rc == 0 and
|
|
lte_image_name in image_state.results[0].stdout
|
|
- name: Create and publish container image to local image server
|
|
ansible.builtin.shell:
|
|
cmd: |
|
|
incus publish --force --alias {{ lte_image_name }} \
|
|
--compression pigz \
|
|
{{ lte_container_name }}
|
|
when: >-
|
|
lte_image_state == 'present' and
|
|
lte_image_name not in image_state.stdout
|