9
.ansible-lint
Normal file
9
.ansible-lint
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
profile: production
|
||||||
|
strict: true
|
||||||
|
|
||||||
|
# Enable checking of loop variable prefixes in roles
|
||||||
|
loop_var_prefix: "^(__|{role}_)"
|
||||||
|
|
||||||
|
exclude_paths:
|
||||||
|
- .github/
|
||||||
22
.github/workflows/kics.yml
vendored
Normal file
22
.github/workflows/kics.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
name: kics
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: ["master"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
kics:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 5
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
name: Check out source code
|
||||||
|
|
||||||
|
- name: run a KICS scan
|
||||||
|
uses: checkmarx/kics-github-action@e01759d524f8abd5bd650d3d5bd4b96d46ebbc1d
|
||||||
|
with:
|
||||||
|
path: .
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
output_path: myResults/
|
||||||
46
.github/workflows/linters.yml
vendored
Normal file
46
.github/workflows/linters.yml
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
---
|
||||||
|
name: linters
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [ "master" ]
|
||||||
|
push:
|
||||||
|
branches: [ "master" ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
ansible-lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 5
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
|
||||||
|
|
||||||
|
- uses: mamba-org/setup-micromamba@7f29b8b80078b1b601dfa018b0f7425c587c63bb
|
||||||
|
with:
|
||||||
|
micromamba-version: '2.4.0-0'
|
||||||
|
environment-file: ci/conda.yml
|
||||||
|
init-shell: bash
|
||||||
|
post-cleanup: 'all'
|
||||||
|
cache-environment: true
|
||||||
|
|
||||||
|
# - name: "Install role dependencies"
|
||||||
|
# run: ansible-galaxy install -r requirements.yml
|
||||||
|
# shell: micromamba-shell {0}
|
||||||
|
|
||||||
|
- name: Check workflow files themselves with ActionLint
|
||||||
|
run: actionlint
|
||||||
|
shell: micromamba-shell {0}
|
||||||
|
|
||||||
|
- name: Check environment files with YAMLLint
|
||||||
|
run: yamllint ci/*.yml
|
||||||
|
shell: micromamba-shell {0}
|
||||||
|
|
||||||
|
- name: "Install collection dependencies"
|
||||||
|
run: ansible-galaxy install -r requirements.yml
|
||||||
|
shell: micromamba-shell {0}
|
||||||
|
|
||||||
|
- name: Run ansible-lint
|
||||||
|
run: ansible-lint -c .ansible-lint
|
||||||
|
shell: micromamba-shell {0}
|
||||||
3
CHANGELOG.md
Normal file
3
CHANGELOG.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
# Ansible Collection - genlab.common
|
# Ansible Collection - genlab.common
|
||||||
|
|
||||||
|
[](https://github.com/corvus-migratorius/genlab.common/actions/workflows/linters.yml)
|
||||||
|
[](https://github.com/corvus-migratorius/genlab.common/actions/workflows/kics.yml)
|
||||||
|
|
||||||
## Roles
|
## Roles
|
||||||
|
|
||||||
- [mount_device](roles/mount_device/README.md)
|
- [mount_device](roles/mount_device/README.md)
|
||||||
|
|||||||
11
ci/conda.yml
Normal file
11
ci/conda.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
name: genlab.common
|
||||||
|
channels:
|
||||||
|
- conda-forge
|
||||||
|
dependencies:
|
||||||
|
- python~=3.13.10
|
||||||
|
- pip==25.3
|
||||||
|
- actionlint
|
||||||
|
- pip:
|
||||||
|
- -r requirements.txt
|
||||||
|
- -r requirements.ci.txt
|
||||||
6
ci/requirements.ci.txt
Normal file
6
ci/requirements.ci.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
ansible-lint
|
||||||
|
molecule==24.12.0
|
||||||
|
molecule-plugins[docker]
|
||||||
|
docker~=7.1.0
|
||||||
|
requests==2.31.0 # pinned to the latest version not breaking Docker SDK
|
||||||
|
yamllint
|
||||||
1
ci/requirements.txt
Normal file
1
ci/requirements.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ansible-core==2.18.11
|
||||||
@@ -9,6 +9,8 @@ description: >-
|
|||||||
The genlab.common collection includes roles for performing deploying and configuring common infrastructural components
|
The genlab.common collection includes roles for performing deploying and configuring common infrastructural components
|
||||||
license_file: LICENSE
|
license_file: LICENSE
|
||||||
tags:
|
tags:
|
||||||
|
- linux
|
||||||
|
- infrastructure
|
||||||
- genlab
|
- genlab
|
||||||
repository: https://github.com/corvus-migratorius/genlab.common
|
repository: https://github.com/corvus-migratorius/genlab.common
|
||||||
issues: https://github.com/corvus-migratorius/genlab.common/issues
|
issues: https://github.com/corvus-migratorius/genlab.common/issues
|
||||||
|
|||||||
6
renovate.json
Normal file
6
renovate.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"config:recommended"
|
||||||
|
]
|
||||||
|
}
|
||||||
3
requirements.yml
Normal file
3
requirements.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
collections:
|
||||||
|
- name: ansible.posix
|
||||||
@@ -10,7 +10,7 @@ galaxy_info:
|
|||||||
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: "Ubuntu"
|
- name: "Ubuntu"
|
||||||
versions: [ "focal", "jammy", "noble" ]
|
versions: ["jammy", "noble"]
|
||||||
|
|
||||||
galaxy_tags: []
|
galaxy_tags: []
|
||||||
|
|
||||||
|
|||||||
@@ -5,19 +5,19 @@
|
|||||||
pre_tasks:
|
pre_tasks:
|
||||||
|
|
||||||
- name: "Check if the disk file already exists"
|
- name: "Check if the disk file already exists"
|
||||||
|
register: mount_device_disk_file
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: /tmp/test_file
|
path: /tmp/test_file
|
||||||
register: disk_file
|
|
||||||
|
|
||||||
- name: "Create a file to act as a disk if it doesn't exist"
|
- name: "Create a file to act as a disk if it doesn't exist"
|
||||||
when: not disk_file.stat.exists
|
when: not mount_device_disk_file.stat.exists
|
||||||
changed_when: false
|
changed_when: false
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
dd if=/dev/zero of=/tmp/test_file bs=1000000 count=100
|
dd if=/dev/zero of=/tmp/test_file bs=1000000 count=100
|
||||||
mkfs.ext3 /tmp/test_file
|
mkfs.ext3 /tmp/test_file
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: genlab.mount_device
|
- role: genlab.common.mount_device
|
||||||
devices:
|
devices:
|
||||||
- what: "/tmp/test_file"
|
- what: "/tmp/test_file"
|
||||||
where: "/test_mount"
|
where: "/test_mount"
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: "Check mountpoint" # noqa: command-instead-of-module
|
- name: "Check mountpoint" # noqa: command-instead-of-module
|
||||||
changed_when: false
|
changed_when: false
|
||||||
register: mounts
|
register: mount_device_mounts
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: mount -l
|
cmd: mount -l
|
||||||
|
|
||||||
- name: "Ensure test_file is mounted on test_mount"
|
- name: "Ensure test_file is mounted on test_mount"
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: "'/tmp/test_file on /test_mount type ext3' in mounts.stdout"
|
that: "'/tmp/test_file on /test_mount type ext3' in mount_device_mounts.stdout"
|
||||||
success_msg: "/test_mount is a mounted"
|
success_msg: "/test_mount is a mounted"
|
||||||
fail_msg: "/test_mount is not on the list of mounts"
|
fail_msg: "/test_mount is not on the list of mounts"
|
||||||
|
|||||||
Reference in New Issue
Block a user