generated from the-liberated-edge/wikijs
adds a first molecule scenario
This commit is contained in:
parent
f5bc08683d
commit
7d0b995efa
@ -0,0 +1,7 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
|
||||
- name: imports and executes the playbook under test
|
||||
ansible.builtin.import_playbook: ../../../launch_linux_container.yml
|
||||
@ -0,0 +1,36 @@
|
||||
---
|
||||
- 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
|
||||
@ -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
|
||||
@ -0,0 +1,7 @@
|
||||
---
|
||||
dependency:
|
||||
name: galaxy
|
||||
platforms:
|
||||
- name: instance
|
||||
verifier:
|
||||
name: ansible
|
||||
@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: Verify
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: stat file
|
||||
ansible.builtin.stat:
|
||||
path: ~/tst.log
|
||||
register: stat_result
|
||||
- name: verify file exists
|
||||
assert:
|
||||
that: stat_result.stat.exists
|
||||
@ -1,4 +1,6 @@
|
||||
---
|
||||
- name: Task is running from within the role
|
||||
ansible.builtin.debug:
|
||||
msg: "This is a task from the linux_container role."
|
||||
ansible.builtin.file:
|
||||
path: ~/tst.log
|
||||
state: touch
|
||||
changed_when: false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user