generated from the-liberated-edge/wikijs
Adds basic container state managementto linux_container role
This commit is contained in:
@@ -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 }}'
|
||||
|
||||
Reference in New Issue
Block a user