39 lines
1.2 KiB
YAML
Executable File
39 lines
1.2 KiB
YAML
Executable File
---
|
|
- name: Container source must be defined (clone_from or container_template)
|
|
ansible.builtin.fail:
|
|
msg: "Neither clone_from or container_template are defined"
|
|
when: clone_from is undefined and container_template is undefined
|
|
|
|
- name: Clone container from another container or template, then update
|
|
when: clone_from is defined
|
|
block:
|
|
- name: Clone from template
|
|
ansible.builtin.include_tasks: clone.yaml
|
|
register: clone_result
|
|
|
|
- name: Update container
|
|
ansible.builtin.include_tasks: update.yaml
|
|
vars:
|
|
container_vmid: "{{ clone_result.vmid }}"
|
|
register: container_result
|
|
|
|
- name: Create the new container
|
|
ansible.builtin.include_tasks: create.yaml
|
|
when: container_template is defined and clone_from is undefined
|
|
|
|
- name: Start the created container and wait for ssh
|
|
vars:
|
|
container_vmid: "{{ container_result.vmid }}"
|
|
ansible.builtin.include_tasks: "{{ item }}"
|
|
loop:
|
|
- start.yaml
|
|
- wait.yaml
|
|
when: container_start
|
|
|
|
- name: Post clone updates
|
|
when: clone_from is defined
|
|
delegate_to: "{{ container_hostname }}"
|
|
block:
|
|
- name: Include post-clone tasks
|
|
ansible.builtin.include_tasks: post-clone.yaml
|