Skip to content

Commit 0f18738

Browse files
lexfreiclaude
andcommitted
feat: initial Ansible collection for Cozystack installation
Ansible collection cozystack.installer that deploys Cozystack on generic Kubernetes clusters (k3s, kubeadm, RKE2) using the official cozy-installer Helm chart via kubernetes.core.helm module. Features: - Automatic Helm 3.17.3 + helm-diff 3.12.5 installation - Two-stage install: operator chart + Platform Package CR - Full idempotency with helm-diff and kubectl diff - Detailed prerequisites documentation (node + controller) - CI pipeline: lint, sanity tests, E2E with idempotency check - GitHub PR and issue templates Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
0 parents  commit 0f18738

File tree

22 files changed

+1120
-0
lines changed

22 files changed

+1120
-0
lines changed

.ansible-lint

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
# Prevent ansible-lint from auto-installing requirements.yml
3+
# (git commit hash versions crash ansible-galaxy's LooseVersion parser).
4+
# CI installs dependencies in a separate step before running lint.
5+
offline: true
6+
7+
skip_list:
8+
# All collection variables use cozystack_ prefix (collection namespace),
9+
# not individual role prefixes.
10+
- var-naming[no-role-prefix]
11+
12+
# Roles inside the collection cannot be resolved by ansible-lint
13+
# during local development (known issue: ansible-lint#2487).
14+
mock_roles:
15+
- cozystack.installer.cozystack
16+
17+
# examples/site.yml imports external playbooks (k3s.orchestration.site)
18+
# that may not be installed during linting.
19+
exclude_paths:
20+
- examples/site.yml

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @lexfrei
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Bug report
3+
about: Report an issue with the collection
4+
labels: bug
5+
---
6+
7+
## Environment
8+
9+
- Ansible version:
10+
- Collection version:
11+
- Kubernetes distribution (k3s/kubeadm/RKE2):
12+
- OS:
13+
14+
## Expected behavior
15+
16+
## Actual behavior
17+
18+
## Steps to reproduce
19+
20+
1.
21+
22+
## Relevant logs
23+
24+
```text
25+
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: Feature request
3+
about: Suggest an enhancement
4+
labels: enhancement
5+
---
6+
7+
## Use case
8+
9+
<!-- What problem does this solve? -->
10+
11+
## Proposed solution
12+
13+
## Alternatives considered

.github/pull_request_template.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Summary
2+
3+
<!-- Brief description of what this PR does and why -->
4+
5+
## Changes
6+
7+
-
8+
9+
## Test plan
10+
11+
- [ ] `ansible-lint` passes
12+
- [ ] `ansible-test sanity` passes
13+
- [ ] Tested on a live cluster (describe environment)
14+
- [ ] Idempotency verified (second run: changed=0)

.github/workflows/test.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
name: Test
3+
4+
on:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
10+
jobs:
11+
lint:
12+
name: Lint
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.12"
22+
23+
- name: Install dependencies
24+
run: pip install ansible-core ansible-lint
25+
26+
- name: Build and install collection
27+
run: |
28+
ansible-galaxy collection build
29+
ansible-galaxy collection install cozystack-installer-*.tar.gz --force
30+
31+
- name: Install collection dependencies
32+
run: ansible-galaxy collection install --requirements-file requirements.yml
33+
34+
- name: Run ansible-lint
35+
run: ansible-lint
36+
37+
sanity:
38+
name: Sanity
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v4
43+
with:
44+
path: ansible_collections/cozystack/installer
45+
46+
- name: Set up Python
47+
uses: actions/setup-python@v5
48+
with:
49+
python-version: "3.12"
50+
51+
- name: Install ansible-core
52+
run: pip install ansible-core
53+
54+
- name: Run sanity tests
55+
working-directory: ansible_collections/cozystack/installer
56+
run: ansible-test sanity --color
57+
58+
e2e:
59+
name: E2E
60+
runs-on: ubuntu-latest
61+
steps:
62+
- name: Checkout
63+
uses: actions/checkout@v4
64+
65+
- name: Set up Python
66+
uses: actions/setup-python@v5
67+
with:
68+
python-version: "3.12"
69+
70+
- name: Install Ansible
71+
run: pip install ansible-core
72+
73+
- name: Build and install collection
74+
run: |
75+
ansible-galaxy collection build
76+
ansible-galaxy collection install cozystack-installer-*.tar.gz --force
77+
78+
- name: Install collection dependencies
79+
run: ansible-galaxy collection install --requirements-file requirements.yml
80+
81+
- name: Run full pipeline
82+
run: >-
83+
sudo env "PATH=$PATH" "HOME=$HOME" ansible-playbook examples/site.yml
84+
--inventory tests/ci-inventory.yml
85+
86+
- name: Verify operator is running
87+
run: |
88+
sudo kubectl --kubeconfig /etc/rancher/k3s/k3s.yaml \
89+
wait deployment/cozystack-operator \
90+
--namespace cozy-system \
91+
--timeout=120s \
92+
--for=condition=Available
93+
94+
- name: Verify CRDs are established
95+
run: |
96+
sudo kubectl --kubeconfig /etc/rancher/k3s/k3s.yaml \
97+
wait crd/packages.cozystack.io \
98+
--for=condition=Established \
99+
--timeout=60s
100+
101+
- name: Verify Platform Package exists
102+
run: |
103+
sudo kubectl --kubeconfig /etc/rancher/k3s/k3s.yaml \
104+
get package cozystack.cozystack-platform \
105+
--namespace cozy-system
106+
107+
- name: Test idempotency (second run)
108+
run: >-
109+
sudo env "PATH=$PATH" "HOME=$HOME" ansible-playbook examples/site.yml
110+
--inventory tests/ci-inventory.yml

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.tar.gz
2+
.DS_Store
3+
*.retry
4+
.ansible/
5+
__pycache__/
6+
*.pyc
7+
FILES.json
8+
MANIFEST.json

CHANGELOG.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
============================
2+
cozystack.installer Release Notes
3+
============================
4+
5+
v1.0.0-rc.1
6+
============
7+
8+
First release as a standalone collection. Synced with Cozystack v1.0.0-rc.1.
9+
10+
Breaking changes from pre-release development:
11+
12+
- Switched from custom chart (``lexfrei/cozystack-installer``) to official
13+
Cozystack installer chart (``ghcr.io/cozystack/cozystack/cozy-installer``)
14+
- Two-stage install: Helm chart deploys operator, Platform Package CR
15+
is applied separately via ``kubectl apply``
16+
- Role ``prepare`` removed from collection — moved to ``examples/prepare-ubuntu.yml``
17+
- ``k3s.orchestration`` removed from dependencies — users compose their own pipeline
18+
- New variables: ``cozystack_operator_variant``, ``cozystack_platform_variant``,
19+
``cozystack_create_platform_package``, ``cozystack_pod_cidr``, etc.
20+
- ``cozystack_root_host`` is no longer required for chart install
21+
(used in Platform Package CR)

0 commit comments

Comments
 (0)