Skip to content

Commit 744e061

Browse files
committed
Restructure project for improved distro support and cleanup
- Add distro-specific group_vars: arch.yml, debian.yml, fedora.yml - Add roles: distro-setup, package-manager - Remove deprecated roles and files: gnome, ssh, wm, requirements.yml, group_vars/all.yml - Update playbook.yml and existing roles for new structure - Add CI and linting configs: .github/workflows/test.yml, .ansible-lint, .yamllint.yml - Update ansible.cfg, setup.sh, README.md - Add LICENSE
1 parent a3b4b71 commit 744e061

File tree

24 files changed

+1029
-504
lines changed

24 files changed

+1029
-504
lines changed

.ansible-lint

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Ansible Lint Configuration
2+
---
3+
exclude_paths:
4+
- .cache/
5+
- .github/
6+
- .git/
7+
- molecule/
8+
- tests/
9+
10+
# Enable all rules by default
11+
use_default_rules: true
12+
13+
# Custom rule configuration
14+
rules:
15+
# Allow long lines in YAML files
16+
line-too-long:
17+
max: 120
18+
19+
# Skip certain rules that are too strict for this use case
20+
skip_list:
21+
- yaml[line-length]
22+
- name[casing] # Allow various naming conventions
23+
- no-changed-when # Allow tasks without changed_when for simplicity
24+
25+
# Enable offline mode for CI
26+
offline: false
27+
28+
# Set minimum supported Ansible version
29+
min_ansible_version: '2.12'

.github/workflows/test.yml

Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
name: Test Ansible Playbook
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
lint:
12+
name: Lint Ansible
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.11'
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install ansible ansible-lint yamllint
27+
28+
- name: Lint YAML files
29+
run: yamllint .
30+
31+
- name: Lint Ansible playbook
32+
run: ansible-lint playbook.yml
33+
34+
test-syntax:
35+
name: Test Ansible Syntax
36+
runs-on: ubuntu-latest
37+
needs: lint
38+
strategy:
39+
matrix:
40+
distribution: ['arch', 'fedora', 'debian']
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v4
44+
45+
- name: Set up Python
46+
uses: actions/setup-python@v4
47+
with:
48+
python-version: '3.11'
49+
50+
- name: Install Ansible
51+
run: |
52+
python -m pip install --upgrade pip
53+
pip install ansible
54+
55+
- name: Test playbook syntax
56+
run: |
57+
ansible-playbook playbook.yml --syntax-check \
58+
-e "current_distro=${{ matrix.distribution }}" \
59+
-e "ansible_user=testuser"
60+
61+
test-playbook:
62+
name: Test Playbook
63+
runs-on: ubuntu-latest
64+
needs: [lint, test-syntax]
65+
strategy:
66+
fail-fast: false
67+
matrix:
68+
include:
69+
- distribution: ubuntu
70+
version: '22.04'
71+
container: 'ubuntu:22.04'
72+
- distribution: ubuntu
73+
version: '20.04'
74+
container: 'ubuntu:20.04'
75+
- distribution: debian
76+
version: '11'
77+
container: 'debian:11'
78+
- distribution: debian
79+
version: '12'
80+
container: 'debian:12'
81+
- distribution: fedora
82+
version: '39'
83+
container: 'fedora:39'
84+
- distribution: fedora
85+
version: '40'
86+
container: 'fedora:40'
87+
- distribution: arch
88+
version: 'latest'
89+
container: 'archlinux:latest'
90+
91+
container:
92+
image: ${{ matrix.container }}
93+
options: --privileged
94+
95+
steps:
96+
- name: Checkout code
97+
uses: actions/checkout@v4
98+
99+
- name: Install dependencies (Ubuntu/Debian)
100+
if: matrix.distribution == 'ubuntu' || matrix.distribution == 'debian'
101+
run: |
102+
apt-get update
103+
apt-get install -y python3 python3-pip sudo curl git systemd
104+
python3 -m pip install ansible
105+
106+
- name: Install dependencies (Fedora)
107+
if: matrix.distribution == 'fedora'
108+
run: |
109+
dnf install -y python3 python3-pip sudo curl git systemd
110+
python3 -m pip install ansible
111+
112+
- name: Install dependencies (Arch)
113+
if: matrix.distribution == 'arch'
114+
run: |
115+
pacman -Sy --noconfirm python python-pip sudo curl git systemd
116+
python -m pip install ansible
117+
118+
- name: Create test user
119+
run: |
120+
useradd -m -s /bin/bash testuser
121+
echo "testuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
122+
123+
- name: Run Ansible playbook (dry-run)
124+
if: matrix.distribution != 'arch'
125+
run: |
126+
ansible-playbook playbook.yml \
127+
--connection=local \
128+
--inventory=localhost, \
129+
--limit=localhost \
130+
--check \
131+
--diff \
132+
-e "ansible_user=testuser" \
133+
-e "current_distro=${{ matrix.distribution == 'ubuntu' && 'debian' || matrix.distribution }}"
134+
env:
135+
ANSIBLE_HOST_KEY_CHECKING: false
136+
137+
- name: Run Ansible playbook (syntax-check for Arch)
138+
if: matrix.distribution == 'arch'
139+
run: |
140+
ansible-playbook playbook.yml \
141+
--syntax-check \
142+
-e "ansible_user=testuser" \
143+
-e "current_distro=arch"
144+
env:
145+
ANSIBLE_HOST_KEY_CHECKING: false
146+
147+
test-minimal-install:
148+
name: Test Comprehensive Install
149+
runs-on: ubuntu-latest
150+
needs: [lint, test-syntax]
151+
strategy:
152+
matrix:
153+
tag_set:
154+
- name: "core-cli"
155+
tags: "core,cli"
156+
- name: "development"
157+
tags: "core,dev"
158+
- name: "shell-setup"
159+
tags: "core,shell,common"
160+
container:
161+
image: ubuntu:22.04
162+
options: --privileged
163+
164+
steps:
165+
- name: Checkout code
166+
uses: actions/checkout@v4
167+
168+
- name: Install dependencies
169+
run: |
170+
apt-get update
171+
apt-get install -y python3 python3-pip sudo curl git systemd
172+
python3 -m pip install ansible
173+
174+
- name: Create test user
175+
run: |
176+
useradd -m -s /bin/bash testuser
177+
echo "testuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
178+
179+
- name: Run playbook with ${{ matrix.tag_set.name }} tags
180+
run: |
181+
ansible-playbook playbook.yml \
182+
--connection=local \
183+
--inventory=localhost, \
184+
--limit=localhost \
185+
-e "ansible_user=testuser" \
186+
-e "current_distro=debian" \
187+
--tags=${{ matrix.tag_set.tags }}
188+
env:
189+
ANSIBLE_HOST_KEY_CHECKING: false
190+
191+
- name: Verify core packages installation
192+
run: |
193+
echo "Verifying core packages are installed..."
194+
which git || echo "WARNING: git not found"
195+
which curl || echo "WARNING: curl not found"
196+
which sudo || echo "WARNING: sudo not found"
197+
python3 --version || echo "WARNING: python3 not found"
198+
199+
- name: Verify CLI tools installation
200+
if: contains(matrix.tag_set.tags, 'cli')
201+
run: |
202+
echo "Verifying CLI tools are installed..."
203+
which zsh || echo "WARNING: zsh not found"
204+
zsh --version || echo "WARNING: zsh not working"
205+
206+
- name: Verify development tools installation
207+
if: contains(matrix.tag_set.tags, 'dev')
208+
run: |
209+
echo "Verifying development tools..."
210+
which node || echo "WARNING: node not found"
211+
which docker || echo "WARNING: docker not found"
212+
213+
test-roles:
214+
name: Test Individual Roles
215+
runs-on: ubuntu-latest
216+
needs: [lint, test-syntax]
217+
strategy:
218+
fail-fast: false
219+
matrix:
220+
role: [distro-setup, package-manager, common, shell, cli, dev]
221+
distribution: [debian, fedora]
222+
container:
223+
image: ${{ matrix.distribution == 'debian' && 'ubuntu:22.04' || 'fedora:40' }}
224+
options: --privileged
225+
226+
steps:
227+
- name: Checkout code
228+
uses: actions/checkout@v4
229+
230+
- name: Install dependencies (Ubuntu/Debian)
231+
if: matrix.distribution == 'debian'
232+
run: |
233+
apt-get update
234+
apt-get install -y python3 python3-pip sudo curl git systemd
235+
python3 -m pip install ansible
236+
237+
- name: Install dependencies (Fedora)
238+
if: matrix.distribution == 'fedora'
239+
run: |
240+
dnf install -y python3 python3-pip sudo curl git systemd
241+
python3 -m pip install ansible
242+
243+
- name: Create test user
244+
run: |
245+
useradd -m -s /bin/bash testuser
246+
echo "testuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
247+
248+
- name: Test role syntax
249+
run: |
250+
ansible-playbook playbook.yml \
251+
--syntax-check \
252+
-e "ansible_user=testuser" \
253+
-e "current_distro=${{ matrix.distribution }}" \
254+
--tags=${{ matrix.role }}
255+
env:
256+
ANSIBLE_HOST_KEY_CHECKING: false
257+
258+
- name: Test role execution (dry-run)
259+
run: |
260+
ansible-playbook playbook.yml \
261+
--connection=local \
262+
--inventory=localhost, \
263+
--limit=localhost \
264+
--check \
265+
--diff \
266+
-e "ansible_user=testuser" \
267+
-e "current_distro=${{ matrix.distribution }}" \
268+
--tags=${{ matrix.role }}
269+
env:
270+
ANSIBLE_HOST_KEY_CHECKING: false

.yamllint.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# YAML Lint Configuration
2+
extends: default
3+
4+
rules:
5+
# Line length
6+
line-length:
7+
max: 120
8+
level: warning
9+
10+
# Comments
11+
comments:
12+
min-spaces-from-content: 1
13+
14+
# Indentation
15+
indentation:
16+
spaces: 2
17+
indent-sequences: true
18+
19+
# Document separators
20+
document-start:
21+
present: true
22+
23+
# Brackets
24+
brackets:
25+
min-spaces-inside: 0
26+
max-spaces-inside: 1
27+
28+
# Braces
29+
braces:
30+
min-spaces-inside: 0
31+
max-spaces-inside: 1
32+
33+
ignore: |
34+
.github/
35+
.git/
36+
*.md

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Saurav Singh Karmwar
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)