generated from the-liberated-edge/wikijs
Adds image creation and publishing
This commit is contained in:
22
roles/image/tasks/image.yml
Normal file
22
roles/image/tasks/image.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
- 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
|
||||
2
roles/image/tasks/main.yml
Normal file
2
roles/image/tasks/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
- ansible.builtin.include_tasks: image.yml
|
||||
Reference in New Issue
Block a user