refactor tasks in role linux_container

This commit is contained in:
emo 2023-11-27 22:56:53 +01:00
parent 8e4bea6f26
commit 1e21b446be
2 changed files with 13 additions and 11 deletions

View File

@ -0,0 +1,12 @@
---
- name: find current container state
ansible.builtin.command: lxc ls {{ lte_container_name }}
register: container_state
changed_when: false
- name: launch debian bookworm linux container
ansible.builtin.shell:
cmd: |
lxc launch \
images:debian/{{ lte_debian_version }}/cloud \
{{ lte_container_name }}
when: (container_state.rc == 1) or ("RUNNING" not in container_state.stdout)

View File

@ -1,12 +1,2 @@
---
- name: find current container state
ansible.builtin.command: lxc ls {{ lte_container_name }}
register: container_state
changed_when: false
- name: launch debian bookworm linux container
ansible.builtin.shell:
cmd: |
lxc launch \
images:debian/{{ lte_debian_version }}/cloud \
{{ lte_container_name }}
when: (container_state.rc == 1) or ("RUNNING" not in container_state.stdout)
- include_tasks: container.yml