Adds image creation and publishing

This commit is contained in:
Emil
2024-03-07 02:36:34 +01:00
parent 2b1923e40a
commit da93d7f4b4
13 changed files with 156 additions and 9 deletions

View 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

View File

@@ -0,0 +1,2 @@
---
- ansible.builtin.include_tasks: image.yml