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

28 lines
972 B
YAML

---
- name: "{{ cookiecutter.app_name | upper }} | Destroy"
hosts: "localhost"
connection: "local"
gather_facts: false
no_log: "{% raw %}{{ molecule_no_log }}{% endraw %}"
tasks:
# Developer must implement.
- name: "{{ cookiecutter.app_name | upper }} | Remove the docker image"
community.docker.docker_container:
name: "{{ cookiecutter.app_name }}"
state: "absent"
# Mandatory configuration for Molecule to function.
- name: "{{ cookiecutter.app_name | upper }} | Populate instance config"
ansible.builtin.set_fact:
instance_conf: {}
- name: "{{ cookiecutter.app_name | upper }} | 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"