i-1 Introduces an Ansible playbook for linux-container with SSH access #2

Merged
emil merged 24 commits from i-1-test-linux-container into main 2024-01-07 00:48:19 +00:00
2 changed files with 4 additions and 4 deletions
Showing only changes of commit 18f21cfa30 - Show all commits

View File

@ -6,7 +6,7 @@
tasks:
- name: find current container state
ansible.builtin.command: lxc ls {{ item.name }}
register: container_state
register: state
changed_when: false
with_items: '{{ molecule_yml.platforms }}'
- name: stop running containers
@ -14,5 +14,5 @@
cmd: |
lxc stop {{ item.name }} && \
lxc rm {{ item.name }}
when: (container_state.results[0].rc == 0) and ("RUNNING" in container_state.results[0].stdout)
when: state.results[0].rc == 0 and "RUNNING" in state.results[0].stdout
with_items: '{{ molecule_yml.platforms }}'

View File

@ -5,8 +5,8 @@
tasks:
- name: find current container state
ansible.builtin.command: lxc ls {{ item.name }}
register: container_state
register: state
with_items: '{{ molecule_yml.platforms }}'
- name: verify launched container is running
assert:
that: (container_state.results[0].rc == 0) and ("RUNNING" in container_state.results[0].stdout)
that: state.results[0].rc == 0 and "RUNNING" in state.results[0].stdout