ansible-infra/collections/ansible_collections/nullified/infrastructure/extensions/molecule/default/destroy.yml
2023-11-08 00:00:00 +00:00

21 lines
621 B
YAML

---
# destroying the instances and removing them from instance-config
- name: Destroy molecule containers
hosts: molecule
gather_facts: false
tasks:
- name: Stop and remove container
delegate_to: localhost
community.docker.docker_container:
name: "{{ inventory_hostname }}"
state: absent
auto_remove: true
- name: Remove dynamic molecule inventory
hosts: localhost
gather_facts: false
tasks:
- name: Remove dynamic inventory file
ansible.builtin.file:
path: "{{ molecule_ephemeral_directory }}/inventory/molecule_inventory.yml"
state: absent