Add molecule test structure
This commit is contained in:
8
molecule/default/converge.yml
Normal file
8
molecule/default/converge.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Include hubblo.scaphandre
|
||||
ansible.builtin.include_role:
|
||||
name: "hubblo.scaphandre"
|
||||
35
molecule/default/create.yml
Normal file
35
molecule/default/create.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
- name: Create
|
||||
hosts: localhost
|
||||
connection: local
|
||||
gather_facts: false
|
||||
# no_log: "{{ molecule_no_log }}"
|
||||
tasks:
|
||||
# TODO: Developer must implement and populate 'server' variable
|
||||
|
||||
- name: Create instance config
|
||||
when: server.changed | default(false) | bool # noqa no-handler
|
||||
block:
|
||||
- name: Populate instance config dict # noqa jinja
|
||||
ansible.builtin.set_fact:
|
||||
instance_conf_dict: {}
|
||||
# instance': "{{ }}",
|
||||
# address': "{{ }}",
|
||||
# user': "{{ }}",
|
||||
# port': "{{ }}",
|
||||
# 'identity_file': "{{ }}", }
|
||||
with_items: "{{ server.results }}"
|
||||
register: instance_config_dict
|
||||
|
||||
- name: Convert instance config dict to a list
|
||||
ansible.builtin.set_fact:
|
||||
instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}"
|
||||
|
||||
- name: Dump instance config
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
# Molecule managed
|
||||
|
||||
{{ instance_conf | to_json | from_json | to_yaml }}
|
||||
dest: "{{ molecule_instance_config }}"
|
||||
mode: "0600"
|
||||
24
molecule/default/destroy.yml
Normal file
24
molecule/default/destroy.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
- name: Destroy
|
||||
hosts: localhost
|
||||
connection: local
|
||||
gather_facts: false
|
||||
# no_log: "{{ molecule_no_log }}"
|
||||
tasks:
|
||||
# Developer must implement.
|
||||
|
||||
# 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
|
||||
|
||||
{{ instance_conf | to_json | from_json | to_yaml }}
|
||||
dest: "{{ molecule_instance_config }}"
|
||||
mode: "0600"
|
||||
when: server.changed | default(false) | bool # noqa no-handler
|
||||
16
molecule/default/molecule.yml
Normal file
16
molecule/default/molecule.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
dependency:
|
||||
name: galaxy
|
||||
driver:
|
||||
name: vagrant
|
||||
provider:
|
||||
name: virtualbox
|
||||
platforms:
|
||||
- name: instance
|
||||
box: debian/bookworm64
|
||||
memory: 512
|
||||
cpus: 1
|
||||
provisioner:
|
||||
name: ansible
|
||||
verifier:
|
||||
name: ansible
|
||||
Reference in New Issue
Block a user