feat!(molecule): switch from docker to vagrant to test system related roles like firewall

This commit is contained in:
NaeiKinDus 2023-12-25 00:00:00 +00:00
parent 639b01c351
commit d25d077253
Signed by: WoodSmellParticle
GPG key ID: 8E52ADFF7CA8AE56
8 changed files with 123 additions and 113 deletions

View file

@ -1,21 +1,28 @@
---
# 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
- name: Destroy
hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Remove dynamic inventory file
ansible.builtin.file:
path: "{{ molecule_ephemeral_directory }}/inventory/molecule_inventory.yml"
state: absent
- name: Destroy molecule instance(s) # noqa fqcn[action]
vagrant:
instances: "{{ molecule_yml.platforms }}"
default_box: "{{ molecule_yml.driver.default_box | default('debian/bookworm64') }}"
provider_name: "{{ molecule_yml.driver.provider.name | default(omit, true) }}"
cachier: "{{ molecule_yml.driver.cachier | default(omit) }}"
force_stop: "{{ item.force_stop | default(true) }}"
state: destroy
register: server
- name: Populate instance config
ansible.builtin.set_fact:
instance_conf: {}
- name: Dump instance config # noqa no-handler
ansible.builtin.copy:
content: |
# Molecule managed
{{ instance_conf | to_json | from_json | to_yaml }}
dest: "{{ molecule_instance_config }}"
mode: "0600"
when: server.changed | bool