From 0f2f969a2b38c2d4a28a44655f79ab570ab1d246 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 4 Oct 2020 12:40:48 +0200 Subject: [PATCH] fix molecule destroy playbook --- molecule/centos7/destroy.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/molecule/centos7/destroy.yml b/molecule/centos7/destroy.yml index 0037b35..ed13099 100644 --- a/molecule/centos7/destroy.yml +++ b/molecule/centos7/destroy.yml @@ -5,10 +5,14 @@ gather_facts: false no_log: "{{ molecule_no_log }}" tasks: + - name: Check existing instance config file + stat: + path: "{{ molecule_instance_config }}" + register: cfg + - name: Populate the instance config set_fact: - instance_conf_file: "{{ lookup('file', molecule_instance_config, errors='ignore') | from_yaml }}" - instance_conf: "{{ instance_conf_file | default([]) }}" + instance_conf: "{{ (lookup('file', molecule_instance_config) | molecule_from_yaml) if cfg.stat.exists else [] }}" - name: Destroy molecule instance(s) hcloud_server: @@ -28,6 +32,9 @@ retries: 300 loop: "{{ server.results }}" + - pause: + seconds: 5 + - name: Destroy volume(s) hcloud_volume: name: "{{ item.instance }}"