Skip to content

Commit fc4c872

Browse files
Add molecule
Former-commit-id: d3214bf
1 parent 7d63f0e commit fc4c872

File tree

12 files changed

+211
-2
lines changed

12 files changed

+211
-2
lines changed

.github/workflows/main.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: molecule test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
schedule:
9+
- cron: '0 6 * * 0'
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: checkout
16+
uses: actions/checkout@v2
17+
- name: molecule
18+
uses: robertdebock/[email protected]
19+
with:
20+
entrypoint: /usr/local/bin/molecule
21+
args: lint
22+
test:
23+
needs:
24+
- lint
25+
runs-on: ubuntu-latest
26+
strategy:
27+
fail-fast: false
28+
steps:
29+
- name: checkout
30+
uses: actions/checkout@v2
31+
with:
32+
path: "${{ github.repository }}"
33+
- name: molecule
34+
uses: robertdebock/[email protected]

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
molecule/default
1+
actions-runner-linux-*

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ System must have access to the GitHub.
1717

1818
CentOS/Fedora systems require EPEL repository.
1919

20-
`PERSONAL_ACCESS_TOKEN` variable needs to be exported to your environment.
20+
`PERSONAL_ACCESS_TOKEN` variable needs to be exported to your environment. The token has to have admin rights for the repo.
2121
Personal Access Token for your GitHub account can be created [here](https://github.com/settings/tokens).
2222

2323
Role Variables

molecule/default/Dockerfile.j2

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Molecule managed
2+
3+
{% if item.registry is defined %}
4+
FROM {{ item.registry.url }}/{{ item.image }}
5+
{% else %}
6+
FROM {{ item.image }}
7+
{% endif %}
8+
9+
{% if item.env is defined %}
10+
{% for var, value in item.env.items() %}
11+
{% if value %}
12+
ENV {{ var }} {{ value }}
13+
{% endif %}
14+
{% endfor %}
15+
{% endif %}
16+
17+
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates iproute2 && apt-get clean; \
18+
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute && dnf clean all; \
19+
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash iproute && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
20+
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml iproute2 && zypper clean -a; \
21+
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
22+
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates iproute2 && xbps-remove -O; fi
23+
24+
ENV ANSIBLE_USER=ansible SUDO_GROUP=wheel DEPLOY_GROUP=deployer
25+
RUN set -xe \
26+
&& groupadd -r ${ANSIBLE_USER} \
27+
&& groupadd -r ${DEPLOY_GROUP} \
28+
&& useradd -m -g ${ANSIBLE_USER} ${ANSIBLE_USER} \
29+
&& usermod -aG ${SUDO_GROUP} ${ANSIBLE_USER} \
30+
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
31+
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers

molecule/default/INSTALL.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
*******
2+
Docker driver installation guide
3+
*******
4+
5+
Requirements
6+
============
7+
8+
* Docker Engine
9+
10+
Install
11+
=======
12+
13+
Please refer to the `Virtual environment`_ documentation for installation best
14+
practices. If not using a virtual environment, please consider passing the
15+
widely recommended `'--user' flag`_ when invoking ``pip``.
16+
17+
.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
18+
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site
19+
20+
.. code-block:: bash
21+
22+
$ pip install 'molecule[docker]'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
505e69bab8d510528aa662ef554436d57c936f38

molecule/default/converge.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- name: Converge
3+
user: ansible
4+
hosts: all
5+
become: yes
6+
vars:
7+
- runner_user: ansible
8+
- github_repo: ansible-github_actions_runner-testrepo
9+
- github_account: monolithprojects
10+
roles:
11+
- role: ansible-github_actions_runner

molecule/default/molecule.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
driver:
3+
name: docker
4+
lint: |
5+
yamllint .
6+
platforms:
7+
- name: CentOS7
8+
image: monolithprojects/systemd-centos7:latest
9+
command: /sbin/init
10+
tmpfs:
11+
- /run
12+
- /tmp
13+
volumes:
14+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
15+
privileged: no
16+
pre_build_image: yes
17+
- name: CentOS8
18+
image: monolithprojects/systemd-centos8:latest
19+
command: /sbin/init
20+
tmpfs:
21+
- /run
22+
- /tmp
23+
volumes:
24+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
25+
privileged: no
26+
pre_build_image: yes
27+
# - name: Ubuntu16
28+
# image: monolithprojects/systemd-ubuntu16:latest
29+
# command: /sbin/init
30+
# tmpfs:
31+
# - /run
32+
# - /tmp
33+
# volumes:
34+
# - /sys/fs/cgroup:/sys/fs/cgroup:ro
35+
# privileged: no
36+
# pre_build_image: yes
37+
# - name: Ubuntu18
38+
# image: monolithprojects/systemd-ubuntu18:latest
39+
# command: /sbin/init
40+
# tmpfs:
41+
# - /run
42+
# - /tmp
43+
# volumes:
44+
# - /sys/fs/cgroup:/sys/fs/cgroup:ro
45+
# privileged: no
46+
# pre_build_image: yes
47+
provisioner:
48+
name: ansible
49+
log: false
50+
tags: install
51+
env:
52+
PERSONAL_ACCESS_TOKEN: $PERSONAL_ACCESS_TOKEN
53+
inventory:
54+
host_vars:
55+
CentOS8:
56+
ansible_python_interpreter: /usr/bin/python3
57+
verifier:
58+
name: ansible
59+
dependency:
60+
name: galaxy
61+
options:
62+
ignore-certs: True
63+
ignore-errors: True
64+
scenario:
65+
test_sequence:
66+
- dependency
67+
- lint
68+
- cleanup
69+
- destroy
70+
- syntax
71+
- create
72+
- prepare
73+
- converge
74+
# - idempotence
75+
- side_effect
76+
- uninstall
77+
- verify
78+
- cleanup
79+
- destroy

molecule/default/requirements.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
- role: robertdebock.epel
3+
version: master
Binary file not shown.

0 commit comments

Comments
 (0)