-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Ansible Molecule on Github Action (#39)
* 🙈 Ignore pycharm files * ➕ Add missing galaxy dependency * ⚗️ Add molecule and github workflow * 🚨 Fix linter * 🚀 Add deploy on galaxy * 🔥 Remove travis, replaced by github actions
- Loading branch information
Showing
16 changed files
with
229 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
|
||
name: Deploy on Ansible Galaxy | ||
|
||
'on': | ||
- push | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
- name: galaxy | ||
uses: robertdebock/[email protected] | ||
with: | ||
galaxy_api_key: ${{ secrets.galaxy_api_key }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
name: Molecule | ||
|
||
'on': | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
scenario: | ||
- debian-10 | ||
- debian-11 | ||
- debian-12 | ||
- ubuntu-18.04 | ||
- ubuntu-20.04 | ||
- ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
path: "${{ github.repository }}" | ||
|
||
- name: Molecule | ||
uses: gofrolist/[email protected] | ||
with: | ||
molecule_options: --base-config molecule/_shared/base.yml | ||
molecule_args: --scenario-name ${{ matrix.scenario }} | ||
molecule_working_dir: "HanXHX/ansible-debian-bootstrap" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
*.swp | ||
*.retry | ||
/ubuntu*.log | ||
/.idea |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Molecule managed | ||
|
||
{% if item.registry is defined %} | ||
FROM {{ item.registry.url }}/{{ item.image }} | ||
{% else %} | ||
FROM {{ item.image }} | ||
{% endif %} | ||
|
||
{% if item.env is defined %} | ||
{% for var, value in item.env.items() %} | ||
{% if value %} | ||
ENV {{ var }} {{ value }} | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y python3 sudo bash ca-certificates iproute2 python-apt-common \ | ||
&& apt-get clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
|
||
scenario: | ||
test_sequence: | ||
- dependency | ||
- syntax | ||
- create | ||
- prepare | ||
- converge | ||
- idempotence | ||
- verify | ||
- destroy | ||
dependency: | ||
name: galaxy | ||
options: | ||
requirements-file: ../../requirements.yml | ||
driver: | ||
name: docker | ||
role_name_check: 1 | ||
provisioner: | ||
name: ansible | ||
config_options: | ||
defaults: | ||
deprecation_warnings: false | ||
callback_whitelist: timer,profile_tasks | ||
fact_caching: jsonfile | ||
fact_caching_connection: ./cache | ||
forks: 100 | ||
connection: | ||
pipelining: true | ||
playbooks: | ||
converge: ../_shared/converge.yml | ||
|
||
# TODO: Add this back in when we have a testinfra verifier | ||
# verifier: | ||
# name: testinfra | ||
# directory: ../_shared/tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
|
||
- name: Converge | ||
hosts: all | ||
gather_facts: true | ||
tasks: | ||
- name: Include role | ||
ansible.builtin.include_role: | ||
name: "hanxhx.debian_bootstrap" | ||
vars: | ||
# Force SysVinit, since systemd won't work in a Docker container | ||
ansible_service_mgr: "sysvinit" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
|
||
platforms: | ||
- name: debian-10 | ||
image: dokken/debian-10 | ||
command: /lib/systemd/systemd | ||
dockerfile: ../_shared/Dockerfile.j2 | ||
capabilities: | ||
- SYS_ADMIN | ||
cgroupns_mode: host | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
privileged: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
|
||
platforms: | ||
- name: debian-11 | ||
image: dokken/debian-11 | ||
command: /lib/systemd/systemd | ||
dockerfile: ../_shared/Dockerfile.j2 | ||
capabilities: | ||
- SYS_ADMIN | ||
cgroupns_mode: host | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
privileged: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
|
||
platforms: | ||
- name: debian-12 | ||
image: dokken/debian-12 | ||
command: /lib/systemd/systemd | ||
dockerfile: ../_shared/Dockerfile.j2 | ||
capabilities: | ||
- SYS_ADMIN | ||
cgroupns_mode: host | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
privileged: true |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
|
||
platforms: | ||
- name: ubuntu-18.04 | ||
image: dokken/ubuntu-18.04 | ||
command: /lib/systemd/systemd | ||
dockerfile: ../_shared/Dockerfile.j2 | ||
capabilities: | ||
- SYS_ADMIN | ||
cgroupns_mode: host | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
privileged: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
|
||
platforms: | ||
- name: ubuntu-20.04 | ||
image: dokken/ubuntu-20.04 | ||
command: /lib/systemd/systemd | ||
dockerfile: ../_shared/Dockerfile.j2 | ||
capabilities: | ||
- SYS_ADMIN | ||
cgroupns_mode: host | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
privileged: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
|
||
platforms: | ||
- name: ubuntu-22.04 | ||
image: dokken/ubuntu-22.04 | ||
command: /lib/systemd/systemd | ||
dockerfile: ../_shared/Dockerfile.j2 | ||
capabilities: | ||
- SYS_ADMIN | ||
cgroupns_mode: host | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
privileged: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
|
||
collections: | ||
- community.general | ||
- ansible.posix |