Skip to content

Commit e241ff4

Browse files
committed
feat: add CI workflow and modernize role code
Add GitHub Actions CI pipeline with linting and syntax checks across multiple Ansible versions. Modernize all tasks to use FQCN (Fully Qualified Collection Names) and fix ansible-lint violations. Changes: - Add .github/workflows/default.yml for CI (yamllint, ansible-lint, syntax) - Add .ansible-lint configuration - Add .yamllint configuration - Add .gitignore for Python, Ansible, and IDE files - Update meta/main.yml with namespace, role_name, and current platforms - Modernize all tasks to use FQCN (ansible.builtin.*, ansible.posix.*, community.general.*) - Fix risky-shell-pipe warnings with set -o pipefail - Add changed_when to all command/shell tasks - Add file permissions (mode) where missing - Capitalize task names for consistency - Fix Jinja2 spacing and template usage in task names No breaking changes to role variables or functionality.
1 parent 38573a7 commit e241ff4

File tree

10 files changed

+273
-291
lines changed

10 files changed

+273
-291
lines changed

.ansible-lint

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
exclude_paths:
3+
- .github/
4+
- tests/
5+
- molecule/
6+
7+
skip_list:
8+
- galaxy[no-changelog]
9+
- galaxy[version-incorrect]
10+
- role-name[path]
11+
12+
warn_list:
13+
- experimental
14+
- ignore-errors
15+
- no-handler
16+
- fqcn[action-core]
17+
18+
use_default_rules: true

.github/workflows/default.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
name: CI
3+
4+
on:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
- master
10+
schedule:
11+
- cron: "0 5 * * 0"
12+
13+
jobs:
14+
lint:
15+
name: Lint
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.12"
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install ansible-core ansible-lint yamllint
30+
31+
- name: Run yamllint
32+
run: yamllint .
33+
34+
- name: Run ansible-lint
35+
run: ansible-lint
36+
37+
syntax:
38+
name: Syntax Check (Ansible ${{ matrix.ansible-version }})
39+
runs-on: ubuntu-latest
40+
strategy:
41+
matrix:
42+
ansible-version:
43+
- "2.14"
44+
- "2.15"
45+
- "2.16"
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v4
49+
50+
- name: Set up Python
51+
uses: actions/setup-python@v5
52+
with:
53+
python-version: "3.12"
54+
55+
- name: Install Ansible
56+
run: |
57+
python -m pip install --upgrade pip
58+
pip install "ansible-core~=${{ matrix.ansible-version }}.0"
59+
60+
- name: Run syntax check
61+
run: |
62+
ansible-playbook tests/test.yml -i tests/inventory --syntax-check

.gitignore

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# Distribution / packaging
7+
.Python
8+
build/
9+
develop-eggs/
10+
dist/
11+
downloads/
12+
eggs/
13+
.eggs/
14+
lib/
15+
lib64/
16+
parts/
17+
sdist/
18+
var/
19+
wheels/
20+
*.egg-info/
21+
.installed.cfg
22+
*.egg
23+
24+
# Ansible
25+
*.retry
26+
.galaxy_install_info
27+
28+
# IDE
29+
.vscode/
30+
.idea/
31+
*.swp
32+
*.swo
33+
*~
34+
35+
# OS
36+
.DS_Store
37+
Thumbs.db
38+
39+
# Testing
40+
.cache/
41+
.pytest_cache/
42+
.tox/
43+
htmlcov/
44+
.coverage
45+
.coverage.*
46+
coverage.xml
47+
*.cover
48+
.ansible/

.yamllint

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
extends: default
3+
4+
rules:
5+
line-length:
6+
max: 160
7+
level: warning
8+
truthy:
9+
allowed-values: ['true', 'false', 'yes', 'no']
10+
comments:
11+
min-spaces-from-content: 1
12+
comments-indentation: false
13+
braces:
14+
max-spaces-inside: 1
15+
octal-values:
16+
forbid-implicit-octal: true

meta/main.yml

Lines changed: 24 additions & 214 deletions
Original file line numberDiff line numberDiff line change
@@ -1,222 +1,32 @@
1+
---
12
galaxy_info:
2-
author: Larry Smith jr
3-
description: An [Ansible] role to install and manage [mdadm] raid arrays.
4-
# company: your company (optional)
3+
role_name: mdadm
4+
namespace: mrlesmithjr
5+
author: Larry Smith Jr.
6+
description: An Ansible role to install and manage mdadm RAID arrays
7+
license: MIT
58

6-
# If the issue tracker for your role is not on github, uncomment the
7-
# next line and provide a value
8-
# issue_tracker_url: http://example.com/issue/tracker
9+
min_ansible_version: "2.10"
910

10-
# Some suggested licenses:
11-
# - BSD (default)
12-
# - MIT
13-
# - GPLv2
14-
# - GPLv3
15-
# - Apache
16-
# - CC-BY
17-
license: license (GPLv2, CC-BY, etc)
18-
19-
min_ansible_version: 1.2
20-
21-
# Optionally specify the branch Galaxy will use when accessing the GitHub
22-
# repo for this role. During role install, if no tags are available,
23-
# Galaxy will use this branch. During import Galaxy will access files on
24-
# this branch. If travis integration is cofigured, only notification for this
25-
# branch will be accepted. Otherwise, in all cases, the repo's default branch
26-
# (usually master) will be used.
27-
#github_branch:
28-
29-
#
30-
# Below are all platforms currently available. Just uncomment
31-
# the ones that apply to your role. If you don't see your
32-
# platform on this list, let us know and we'll get it added!
33-
#
3411
platforms:
35-
#- name: OpenBSD
36-
# versions:
37-
# - all
38-
# - 5.6
39-
# - 5.7
40-
# - 5.8
41-
# - 5.9
42-
# - 6.0
43-
#- name: Fedora
44-
# versions:
45-
# - all
46-
# - 16
47-
# - 17
48-
# - 18
49-
# - 19
50-
# - 20
51-
# - 21
52-
# - 22
53-
# - 23
54-
# - 24
55-
# - 25
56-
#- name: DellOS
57-
# versions:
58-
# - all
59-
# - 10
60-
# - 6
61-
# - 9
62-
#- name: MacOSX
63-
# versions:
64-
# - all
65-
# - 10.10
66-
# - 10.11
67-
# - 10.12
68-
# - 10.7
69-
# - 10.8
70-
# - 10.9
71-
#- name: Synology
72-
# versions:
73-
# - all
74-
# - any
75-
#- name: Junos
76-
# versions:
77-
# - all
78-
# - any
79-
#- name: GenericBSD
80-
# versions:
81-
# - all
82-
# - any
83-
#- name: Void Linux
84-
# versions:
85-
# - all
86-
# - any
87-
#- name: GenericLinux
88-
# versions:
89-
# - all
90-
# - any
91-
#- name: NXOS
92-
# versions:
93-
# - all
94-
# - any
95-
#- name: IOS
96-
# versions:
97-
# - all
98-
# - any
99-
#- name: Amazon
100-
# versions:
101-
# - all
102-
# - 2013.03
103-
# - 2013.09
104-
# - 2016.03
105-
# - 2016.09
106-
#- name: ArchLinux
107-
# versions:
108-
# - all
109-
# - any
110-
#- name: FreeBSD
111-
# versions:
112-
# - all
113-
# - 10.0
114-
# - 10.1
115-
# - 10.2
116-
# - 10.3
117-
# - 11.0
118-
# - 8.0
119-
# - 8.1
120-
# - 8.2
121-
# - 8.3
122-
# - 8.4
123-
# - 9.0
124-
# - 9.1
125-
# - 9.1
126-
# - 9.2
127-
# - 9.3
128-
- name: Ubuntu
129-
versions:
130-
# - all
131-
# - lucid
132-
# - maverick
133-
# - natty
134-
# - oneiric
135-
# - precise
136-
# - quantal
137-
# - raring
138-
# - saucy
139-
- trusty
140-
# - utopic
141-
# - vivid
142-
# - wily
143-
- xenial
144-
# - yakkety
145-
- name: Debian
146-
versions:
147-
# - all
148-
# - etch
149-
- jessie
150-
# - lenny
151-
# - sid
152-
# - squeeze
153-
# - stretch
154-
# - wheezy
155-
#- name: Alpine
156-
# versions:
157-
# - all
158-
# - any
159-
- name: EL
160-
versions:
161-
# - all
162-
# - 5
163-
# - 6
164-
- 7
165-
#- name: Windows
166-
# versions:
167-
# - all
168-
# - 2012R2
169-
#- name: SmartOS
170-
# versions:
171-
# - all
172-
# - any
173-
#- name: opensuse
174-
# versions:
175-
# - all
176-
# - 12.1
177-
# - 12.2
178-
# - 12.3
179-
# - 13.1
180-
# - 13.2
181-
#- name: SLES
182-
# versions:
183-
# - all
184-
# - 10SP3
185-
# - 10SP4
186-
# - 11
187-
# - 11SP1
188-
# - 11SP2
189-
# - 11SP3
190-
# - 11SP4
191-
# - 12
192-
# - 12SP1
193-
#- name: GenericUNIX
194-
# versions:
195-
# - all
196-
# - any
197-
#- name: Solaris
198-
# versions:
199-
# - all
200-
# - 10
201-
# - 11.0
202-
# - 11.1
203-
# - 11.2
204-
# - 11.3
205-
#- name: eos
206-
# versions:
207-
# - all
208-
# - Any
12+
- name: Ubuntu
13+
versions:
14+
- focal
15+
- jammy
16+
- noble
17+
- name: Debian
18+
versions:
19+
- bullseye
20+
- bookworm
21+
- name: EL
22+
versions:
23+
- "8"
24+
- "9"
20925

21026
galaxy_tags:
211-
# List tags for your role here, one per line. A tag is
212-
# a keyword that describes and categorizes the role.
213-
# Users find roles by searching for tags. Be sure to
214-
# remove the '[]' above if you add tags to this list.
215-
#
216-
# NOTE: A tag is limited to a single word comprised of
217-
# alphanumeric characters. Maximum 20 tags per role.
21827
- system
28+
- storage
29+
- raid
30+
- mdadm
31+
21932
dependencies: []
220-
# List your role dependencies here, one per line.
221-
# Be sure to remove the '[]' above if you add dependencies
222-
# to this list.

0 commit comments

Comments
 (0)