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

28 lines
972 B
YAML
Raw Permalink Normal View History

---
2023-04-30 13:07:53 +02:00
- name: "{{ cookiecutter.app_name | upper }} | Destroy"
hosts: "localhost"
connection: "local"
gather_facts: false
no_log: "{% raw %}{{ molecule_no_log }}{% endraw %}"
tasks:
# Developer must implement.
2023-04-30 13:07:53 +02:00
- name: "{{ cookiecutter.app_name | upper }} | Remove the docker image"
community.docker.docker_container:
2023-04-30 13:07:53 +02:00
name: "{{ cookiecutter.app_name }}"
state: "absent"
# Mandatory configuration for Molecule to function.
2023-04-30 13:07:53 +02:00
- name: "{{ cookiecutter.app_name | upper }} | Populate instance config"
ansible.builtin.set_fact:
instance_conf: {}
2023-04-30 13:07:53 +02:00
- 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
2023-04-30 13:07:53 +02:00
when: "server.changed | default(false) | bool"