cookiecutter-ansible-role-d.../ansible-role-{{cookiecutter.app_name}}/molecule/default/destroy.yml

28 lines
802 B
YAML
Raw Normal View History

---
- name: Destroy
hosts: localhost
connection: local
gather_facts: false
no_log: "{% raw %}{{ molecule_no_log }}{% endraw %}"
tasks:
# Developer must implement.
- name: Remove the docker image
community.docker.docker_container:
name: {{ cookiecutter.app_name }}
state: absent
# Mandatory configuration for Molecule to function.
- name: Populate instance config
ansible.builtin.set_fact:
instance_conf: {}
- name: Dump instance config
ansible.builtin.copy:
content: |
# Molecule managed
{% raw %}{{ instance_conf | to_json | from_json | to_yaml }}{% endraw %}
dest: "{% raw %}{{ molecule_instance_config }}{% endraw %}"
mode: 0600
when: server.changed | default(false) | bool