-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added molecule and ansible-lint github actions Co-authored-by: Lane Jennison <lane@lane-fu.com> Co-authored-by: Bas Meijer <bas.meijer@me.com> Co-authored-by: Michal Muransky <mike.muransky@gmail.com> Co-authored-by: adawalli <adam.wallis@gmail.com> Co-authored-by: Sebastian Gumprich <rndmh3ro@users.noreply.github.com> Co-authored-by: John Adams <john@hexb.it> Co-authored-by: jebas <jeff.l.baskin@gmail.com> Co-authored-by: Michal Muransky <michal.muransky@pan-net.eu> Co-authored-by: beechesII <grau.christopher@googlemail.com>
- Loading branch information
1 parent
92d4e33
commit 82c3714
Showing
48 changed files
with
470 additions
and
50 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,15 @@ | ||
--- | ||
# .ansible-lint | ||
exclude_paths: | ||
- .cache/ # implicit unless exclude_paths is defined in config | ||
- .yamllint | ||
- molecule/ | ||
- tests/ | ||
- .github/ | ||
|
||
# install collection dependencies | ||
offline: false | ||
|
||
# skip these linting stuff | ||
skip_list: | ||
- '106' |
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,14 @@ | ||
--- | ||
name: ansible-lint | ||
on: | ||
pull_request: | ||
branches: ["main", "master", "stable", "release/v*"] | ||
jobs: | ||
build: | ||
name: Ansible Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Run ansible-lint | ||
uses: ansible/ansible-lint@v6.22.1 |
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,40 @@ | ||
--- | ||
name: molecule | ||
on: | ||
pull_request: | ||
branches: ["main", "master", "stable", "release/v*"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 4 | ||
matrix: | ||
scenario: | ||
- centos-7 | ||
- centos-8-stream | ||
- centos-9-stream | ||
- debian-10 | ||
- debian-11 | ||
- debian-12 | ||
- fedora-38 | ||
- fedora-39 | ||
# - oraclelinux-7 | ||
- oraclelinux-8 | ||
- oraclelinux-9 | ||
- ubuntu-20.04 | ||
- ubuntu-22.04 | ||
- ubuntu-23.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
path: "${{ github.repository }}" | ||
|
||
- name: Molecule | ||
uses: gofrolist/molecule-action@v2 | ||
with: | ||
molecule_working_dir: "${{ github.repository }}" | ||
molecule_options: --base-config molecule/_shared/base.yml | ||
molecule_args: --scenario-name ${{ matrix.scenario }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
extends: default | ||
|
||
rules: | ||
braces: | ||
max-spaces-inside: 1 | ||
level: error | ||
brackets: | ||
max-spaces-inside: 1 | ||
level: error | ||
line-length: disable | ||
truthy: disable | ||
document-start: disable |
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
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,29 @@ | ||
# 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 if [ $(command -v apt-get) ]; then \ | ||
if grep -q "Debian GNU/Linux 10" /etc/os-release; then \ | ||
apt-get update && apt-get install -y systemd python sudo bash ca-certificates iproute2 python-apt-common && apt-get clean; \ | ||
elif grep -q "Debian GNU/Linux 11" /etc/os-release; then \ | ||
apt-get update && apt-get install -y systemd python sudo bash ca-certificates iproute2 python-apt-common && apt-get clean; \ | ||
else \ | ||
apt-get update && apt-get install -y systemd python3 sudo bash ca-certificates iproute2 python3-apt && apt-get clean; \ | ||
fi \ | ||
elif [ $(command -v dnf) ]; then \ | ||
dnf makecache && dnf --assumeyes install systemd python3 sudo bash iproute && dnf clean all; \ | ||
elif [ $(command -v yum) ]; then \ | ||
yum makecache fast && yum install -y systemd python sudo yum-plugin-ovl bash iproute && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ | ||
fi |
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,34 @@ | ||
--- | ||
scenario: | ||
test_sequence: | ||
- dependency | ||
- syntax | ||
- create | ||
- prepare | ||
- converge | ||
- verify | ||
- destroy | ||
dependency: | ||
name: galaxy | ||
driver: | ||
name: docker | ||
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: | ||
prepare: ../_shared/prepare.yml | ||
converge: ../_shared/converge.yml | ||
inventory: | ||
group_vars: | ||
nomad_instances: | ||
nomad_node_role: both | ||
verifier: | ||
name: ansible |
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,9 @@ | ||
--- | ||
- name: Converge | ||
hosts: all | ||
roles: | ||
- role: ansible-nomad | ||
|
||
vars: | ||
# TODO: Probably we need to install syslog-ng/rsyslog first | ||
nomad_syslog_enable: False |
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,15 @@ | ||
--- | ||
- name: Prepare | ||
hosts: localhost | ||
connection: local | ||
|
||
tasks: | ||
- name: Install OS packages | ||
package: | ||
name: unzip | ||
become: true | ||
|
||
- name: Install netaddr dependency on controlling host | ||
pip: | ||
name: netaddr | ||
become: false |
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,59 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
tasks: | ||
|
||
- name: Verify that /etc/nomad.d/base.hcl exists | ||
ansible.builtin.file: | ||
path: /etc/nomad.d/base.hcl | ||
state: file | ||
register: result_nomad_base_hcl | ||
|
||
- name: Validate that /etc/nomad.d/base.hcl exists | ||
ansible.builtin.assert: | ||
that: | ||
- result_nomad_base_hcl.state == 'file' | ||
- result_nomad_base_hcl.owner == 'root' | ||
- result_nomad_base_hcl.group == 'root' | ||
- result_nomad_base_hcl.mode == '0644' | ||
|
||
- name: Verify that /etc/nomad.d/client.hcl exists | ||
ansible.builtin.file: | ||
path: /etc/nomad.d/client.hcl | ||
state: file | ||
register: result_nomad_client_hcl | ||
|
||
- name: Validate that /etc/nomad.d/client.hcl exists | ||
ansible.builtin.assert: | ||
that: | ||
- result_nomad_client_hcl.state == 'file' | ||
- result_nomad_client_hcl.owner == 'root' | ||
- result_nomad_client_hcl.group == 'root' | ||
- result_nomad_client_hcl.mode == '0644' | ||
|
||
- name: Verify that /etc/nomad.d/server.hcl exists | ||
ansible.builtin.file: | ||
path: /etc/nomad.d/server.hcl | ||
state: file | ||
register: result_nomad_server_hcl | ||
|
||
- name: Validate that /etc/nomad.d/server.hcl exists | ||
ansible.builtin.assert: | ||
that: | ||
- result_nomad_server_hcl.state == 'file' | ||
- result_nomad_server_hcl.owner == 'root' | ||
- result_nomad_server_hcl.group == 'root' | ||
- result_nomad_server_hcl.mode == '0644' | ||
|
||
- name: Verify that serivce nomad is running | ||
ansible.builtin.service: | ||
name: nomad | ||
state: started | ||
register: result_nomad_service | ||
|
||
- name: Validate that serivce nomad is running | ||
ansible.builtin.assert: | ||
that: | ||
- result_nomad_service.state == 'started' | ||
- result_nomad_service.changed == false | ||
- result_nomad_service.name == 'nomad' |
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,14 @@ | ||
--- | ||
platforms: | ||
- name: centos-7 | ||
groups: | ||
- nomad_instances | ||
image: dokken/centos-7 | ||
dockerfile: ../_shared/Dockerfile.j2 | ||
capabilities: | ||
- SYS_ADMIN | ||
cgroupns_mode: host | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
privileged: true | ||
command: /usr/lib/systemd/systemd |
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 @@ | ||
../_shared/verify.yml |
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,14 @@ | ||
--- | ||
platforms: | ||
- name: centos-stream-8 | ||
groups: | ||
- nomad_instances | ||
image: dokken/centos-stream-8 | ||
dockerfile: ../_shared/Dockerfile.j2 | ||
capabilities: | ||
- SYS_ADMIN | ||
cgroupns_mode: host | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
privileged: true | ||
command: /usr/lib/systemd/systemd |
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 @@ | ||
../_shared/verify.yml |
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,14 @@ | ||
--- | ||
platforms: | ||
- name: centos-stream-9 | ||
groups: | ||
- nomad_instances | ||
image: dokken/centos-stream-9 | ||
dockerfile: ../_shared/Dockerfile.j2 | ||
capabilities: | ||
- SYS_ADMIN | ||
cgroupns_mode: host | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
privileged: true | ||
command: /usr/lib/systemd/systemd |
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 @@ | ||
../_shared/verify.yml |
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,14 @@ | ||
--- | ||
platforms: | ||
- name: debian-10 | ||
groups: | ||
- nomad_instances | ||
image: dokken/debian-10 | ||
dockerfile: ../_shared/Dockerfile.j2 | ||
capabilities: | ||
- SYS_ADMIN | ||
cgroupns_mode: host | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
privileged: true | ||
command: /bin/systemd |
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 @@ | ||
../_shared/verify.yml |
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,14 @@ | ||
--- | ||
platforms: | ||
- name: debian-11 | ||
groups: | ||
- nomad_instances | ||
image: dokken/debian-11 | ||
dockerfile: ../_shared/Dockerfile.j2 | ||
capabilities: | ||
- SYS_ADMIN | ||
cgroupns_mode: host | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
privileged: true | ||
command: /bin/systemd |
Oops, something went wrong.