Skip to content

Commit aa649e3

Browse files
committed
Molecule for CI.
1 parent 7878e89 commit aa649e3

File tree

7 files changed

+135
-0
lines changed

7 files changed

+135
-0
lines changed

.yamllint

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
# Based on ansible-lint config
3+
extends: default
4+
5+
rules:
6+
braces:
7+
max-spaces-inside: 1
8+
level: error
9+
brackets:
10+
max-spaces-inside: 1
11+
level: error
12+
colons:
13+
max-spaces-after: -1
14+
level: error
15+
commas:
16+
max-spaces-after: -1
17+
level: error
18+
comments: disable
19+
comments-indentation: disable
20+
document-start: disable
21+
empty-lines:
22+
max: 3
23+
level: error
24+
hyphens:
25+
level: error
26+
indentation: disable
27+
key-duplicates: enable
28+
line-length: disable
29+
new-line-at-end-of-file: disable
30+
new-lines:
31+
type: unix
32+
trailing-spaces: disable
33+
truthy: disable

molecule/default/INSTALL.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*******
2+
Delegated driver installation guide
3+
*******
4+
5+
Requirements
6+
============
7+
8+
This driver is delegated to the developer. Up to the developer to implement
9+
requirements.
10+
11+
Install
12+
=======
13+
14+
This driver is delegated to the developer. Up to the developer to implement
15+
requirements.

molecule/default/converge.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
- name: Converge
3+
hosts: all
4+
tasks:
5+
- name: "Include ansible-ipfs"
6+
include_role:
7+
name: "ansible-ipfs"

molecule/default/create.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
- name: Create
3+
hosts: localhost
4+
connection: local
5+
gather_facts: false
6+
no_log: "{{ molecule_no_log }}"
7+
tasks:
8+
9+
# TODO: Developer must implement and populate 'server' variable
10+
11+
- when: server.changed | default(false) | bool
12+
block:
13+
- name: Populate instance config dict
14+
set_fact:
15+
instance_conf_dict: {
16+
'instance': "{{ }}",
17+
'address': "{{ }}",
18+
'user': "{{ }}",
19+
'port': "{{ }}",
20+
'identity_file': "{{ }}", }
21+
with_items: "{{ server.results }}"
22+
register: instance_config_dict
23+
24+
- name: Convert instance config dict to a list
25+
set_fact:
26+
instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}"
27+
28+
- name: Dump instance config
29+
copy:
30+
content: |
31+
# Molecule managed
32+
33+
{{ instance_conf | to_json | from_json | to_yaml }}
34+
dest: "{{ molecule_instance_config }}"
35+
mode: 0600

molecule/default/destroy.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
- name: Destroy
3+
hosts: localhost
4+
connection: local
5+
gather_facts: false
6+
no_log: "{{ molecule_no_log }}"
7+
tasks:
8+
# Developer must implement.
9+
10+
# Mandatory configuration for Molecule to function.
11+
12+
- name: Populate instance config
13+
set_fact:
14+
instance_conf: {}
15+
16+
- name: Dump instance config
17+
copy:
18+
content: |
19+
# Molecule managed
20+
21+
{{ instance_conf | to_json | from_json | to_yaml }}
22+
dest: "{{ molecule_instance_config }}"
23+
mode: 0600
24+
when: server.changed | default(false) | bool

molecule/default/molecule.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
dependency:
3+
name: galaxy
4+
driver:
5+
name: delegated
6+
platforms:
7+
- name: instance
8+
provisioner:
9+
name: ansible
10+
verifier:
11+
name: ansible

molecule/default/verify.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
# This is an example playbook to execute Ansible tests.
3+
4+
- name: Verify
5+
hosts: all
6+
gather_facts: false
7+
tasks:
8+
- name: Example assertion
9+
assert:
10+
that: true

0 commit comments

Comments
 (0)