generated from the-liberated-edge/wikijs
i-8 Implements image creation and publishing in playbook #22
@ -1,18 +1,14 @@
|
||||
---
|
||||
- name: Create
|
||||
- name: Destroy testing resources
|
||||
hosts: localhost
|
||||
connection: local
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: find current container state
|
||||
ansible.builtin.command: incus ls "{{ item.name }}-container"
|
||||
register: state
|
||||
changed_when: false
|
||||
with_items: '{{ molecule_yml.platforms }}'
|
||||
- name: stop and remove running containers
|
||||
ansible.builtin.shell:
|
||||
cmd: |
|
||||
incus stop "{{ item.name }}-container" && \
|
||||
incus rm "{{ item.name }}-container"
|
||||
when: state.results[0].rc == 0 and "RUNNING" in state.results[0].stdout
|
||||
- name: Stop and remove the test container
|
||||
ansible.builtin.include_role:
|
||||
name: >-
|
||||
theliberatededge.test_linux_containers.linux_container
|
||||
vars:
|
||||
lte_container_state: absent
|
||||
lte_container_name: '{{ item.name }}-container'
|
||||
with_items: '{{ molecule_yml.platforms }}'
|
||||
|
||||
@ -9,9 +9,10 @@
|
||||
incus stop {{ lte_container_name }} && \
|
||||
incus rm {{ lte_container_name }}
|
||||
when: >
|
||||
lte_container_state == "absent" and
|
||||
state.results[0].rc == 0 and
|
||||
"RUNNING" in state.results[0].stdout
|
||||
lte_container_state == 'absent' and
|
||||
'results' in container_state and
|
||||
container_state.results[0].rc == 0 and
|
||||
'RUNNING' in container_state.results[0].stdout
|
||||
- name: launch debian bookworm linux container
|
||||
ansible.builtin.shell:
|
||||
cmd: |
|
||||
@ -19,14 +20,14 @@
|
||||
images:debian/{{ lte_debian_version }}/cloud \
|
||||
{{ lte_container_name }}
|
||||
when: >
|
||||
lte_container_state == "present" and
|
||||
container_state.rc == 1 or
|
||||
"RUNNING" not in container_state.stdout
|
||||
lte_container_state == 'present' and
|
||||
(container_state.rc == 1) or
|
||||
("RUNNING" not in container_state.stdout)
|
||||
- name: update apt cache and upgrade system packages
|
||||
ansible.builtin.shell:
|
||||
cmd: |-
|
||||
incus exec {{ lte_container_name }} -- \
|
||||
bash -c \
|
||||
'/usr/bin/apt update && /usr/bin/apt upgrade -y'
|
||||
when: lte_container_state == "present"
|
||||
when: lte_container_state == 'present'
|
||||
changed_when: false
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
---
|
||||
- ansible.builtin.include_tasks: container.yml
|
||||
- ansible.builtin.include_tasks: ume.yml
|
||||
when: lte_container_state == "present"
|
||||
- ansible.builtin.include_tasks: openssh-server.yml
|
||||
when: lte_container_state == "present"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user