This commit is contained in:
parent
15d3b1f929
commit
bd53c2d502
@ -6,16 +6,9 @@
|
|||||||
no_log: "{{ molecule_no_log }}"
|
no_log: "{{ molecule_no_log }}"
|
||||||
tasks:
|
tasks:
|
||||||
- name: Populate the instance config
|
- name: Populate the instance config
|
||||||
block:
|
|
||||||
- name: Populate instance config from file
|
|
||||||
set_fact:
|
set_fact:
|
||||||
instance_conf: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}"
|
instance_conf_file: "{{ lookup('file', molecule_instance_config, errors='ignore') | from_yaml }}"
|
||||||
skip_instances: false
|
instance_conf: "{{ instance_conf_file | default([]) }}"
|
||||||
rescue:
|
|
||||||
- name: Populate instance config when file missing
|
|
||||||
set_fact:
|
|
||||||
instance_conf: {}
|
|
||||||
skip_instances: true
|
|
||||||
|
|
||||||
- name: Destroy molecule instance(s)
|
- name: Destroy molecule instance(s)
|
||||||
hcloud_server:
|
hcloud_server:
|
||||||
@ -24,7 +17,6 @@
|
|||||||
state: absent
|
state: absent
|
||||||
register: server
|
register: server
|
||||||
loop: "{{ instance_conf }}"
|
loop: "{{ instance_conf }}"
|
||||||
when: not skip_instances
|
|
||||||
async: 7200
|
async: 7200
|
||||||
poll: 0
|
poll: 0
|
||||||
|
|
||||||
@ -61,9 +53,7 @@
|
|||||||
hcloud_ssh_key:
|
hcloud_ssh_key:
|
||||||
name: "{{ instance_conf[0].ssh_key_name }}"
|
name: "{{ instance_conf[0].ssh_key_name }}"
|
||||||
state: absent
|
state: absent
|
||||||
when:
|
when: (instance_conf | default([])) | length > 0
|
||||||
- not skip_instances
|
|
||||||
- (instance_conf | default([])) | length > 0 # must contain at least one instance
|
|
||||||
|
|
||||||
# Mandatory configuration for Molecule to function.
|
# Mandatory configuration for Molecule to function.
|
||||||
|
|
||||||
|
@ -6,16 +6,9 @@
|
|||||||
no_log: "{{ molecule_no_log }}"
|
no_log: "{{ molecule_no_log }}"
|
||||||
tasks:
|
tasks:
|
||||||
- name: Populate the instance config
|
- name: Populate the instance config
|
||||||
block:
|
|
||||||
- name: Populate instance config from file
|
|
||||||
set_fact:
|
set_fact:
|
||||||
instance_conf: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}"
|
instance_conf_file: "{{ lookup('file', molecule_instance_config, errors='ignore') | from_yaml }}"
|
||||||
skip_instances: false
|
instance_conf: "{{ instance_conf_file | default([]) }}"
|
||||||
rescue:
|
|
||||||
- name: Populate instance config when file missing
|
|
||||||
set_fact:
|
|
||||||
instance_conf: {}
|
|
||||||
skip_instances: true
|
|
||||||
|
|
||||||
- name: Destroy molecule instance(s)
|
- name: Destroy molecule instance(s)
|
||||||
hcloud_server:
|
hcloud_server:
|
||||||
@ -24,7 +17,6 @@
|
|||||||
state: absent
|
state: absent
|
||||||
register: server
|
register: server
|
||||||
loop: "{{ instance_conf }}"
|
loop: "{{ instance_conf }}"
|
||||||
when: not skip_instances
|
|
||||||
async: 7200
|
async: 7200
|
||||||
poll: 0
|
poll: 0
|
||||||
|
|
||||||
@ -61,9 +53,7 @@
|
|||||||
hcloud_ssh_key:
|
hcloud_ssh_key:
|
||||||
name: "{{ instance_conf[0].ssh_key_name }}"
|
name: "{{ instance_conf[0].ssh_key_name }}"
|
||||||
state: absent
|
state: absent
|
||||||
when:
|
when: (instance_conf | default([])) | length > 0
|
||||||
- not skip_instances
|
|
||||||
- (instance_conf | default([])) | length > 0 # must contain at least one instance
|
|
||||||
|
|
||||||
# Mandatory configuration for Molecule to function.
|
# Mandatory configuration for Molecule to function.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user