generated from the-liberated-edge/wikijs
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
|