Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e17b469
feat: migrate from aap-libvirt-infra
xnoto Dec 21, 2025
e1479fb
fix: use system python for ansible-lint pre-commit hook
xnoto Dec 21, 2025
8c3f6b6
fix: remove ansible-playbook --check from CI
xnoto Dec 21, 2025
0087338
refactor: replace URI calls with awx.awx collection modules
xnoto Dec 21, 2025
5d8443c
fix: split plays so secrets load before module_defaults evaluation
xnoto Dec 21, 2025
e53a389
refactor: split CI into pre-commit and ansible-check jobs
xnoto Dec 21, 2025
1601aee
fix: run ansible-lint via pre-commit in CI for consistency
xnoto Dec 21, 2025
a35227f
refactor: single CI job with PR comment for ansible check output
xnoto Dec 21, 2025
4142a7a
fix: skip project sync in check mode, disable scm_update_on_launch
xnoto Dec 21, 2025
67d5829
fix: suppress localhost inventory warning in CI and Makefile
xnoto Dec 21, 2025
ea12997
refactor: update PR comments instead of creating new ones
xnoto Dec 21, 2025
d351151
fix: suppress inventory warnings and improve CI failure handling
xnoto Dec 21, 2025
2f18e28
fix: embed HTML marker in comment body for find-comment to work
xnoto Dec 21, 2025
75d01d8
test: verify PR comment update
xnoto Dec 21, 2025
7a72fc8
fix: skip prepare-comment step for non-PR events
xnoto Dec 21, 2025
e97736a
refactor: delete and recreate PR comment for fresh timestamp
xnoto Dec 21, 2025
59a4217
refactor: use johanwulf/replace-comment action
xnoto Dec 21, 2025
52ab685
fix: use full version tag v1.0.0 for replace-comment
xnoto Dec 21, 2025
af0bae2
refactor: migrate from AAP to AWX
xnoto Dec 22, 2025
bfdaecc
chore: align pre-commit config and fix trailing newlines
xnoto Dec 22, 2025
6a36084
merge: resolve conflicts with main, keep AWX refactor
xnoto Dec 22, 2025
c8c9cf0
fix: downgrade pre-commit-hooks to v5.0.0 for Python 3.12 compat
xnoto Dec 22, 2025
fcca7b4
fix: add setup-python for Python 3.13, restore pre-commit-hooks v6.0.0
xnoto Dec 22, 2025
f433754
fix: install python3.13 via dnf in container
xnoto Dec 22, 2025
7dd2d7b
fix: use setup-python and pip install pre-commit
xnoto Dec 22, 2025
5b245e2
fix: use --break-system-packages for pip install
xnoto Dec 22, 2025
efe7354
refactor: split lint and check jobs, use pre-commit/action
xnoto Dec 22, 2025
aee5ced
fix: exclude playbooks from ansible-lint (vault-encrypted vars)
xnoto Dec 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
exclude_paths:
- .cache/
- .github/
- secrets/
- vars/
- playbooks/
18 changes: 15 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,25 @@ permissions:
pull-requests: write

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: setup python
uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: pre-commit
uses: pre-commit/action@v3.0.1

check:
runs-on: ubuntu-latest
container:
image: ghcr.io/makeitworkcloud/runner:latest
needs: [lint]
env:
SOPS_AGE_KEY: ${{ secrets.SOPS_AGE_KEY }}
ANSIBLE_VAULT_PASSWORD_FILE: ./scripts/vault.bash
Expand All @@ -27,9 +42,6 @@ jobs:
- name: dependencies
run: ansible-galaxy collection install -r requirements.yml

- name: lint
run: pre-commit run --all-files

- name: check
id: check
continue-on-error: true
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**/*.ansible
**/*.swp
**/*.log
**/1
**/1
9 changes: 7 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v4.0.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
Expand All @@ -8,12 +13,12 @@ repos:
- id: check-vcs-permalinks
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/ansible/ansible-lint
rev: v25.12.1
hooks:
- id: ansible-lint
language_version: python3
additional_dependencies:
- ansible
args: [--exclude=secrets/, --exclude=vars/]
40 changes: 19 additions & 21 deletions .setup_project.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env ansible-playbook
# File: .setup_project.yml
# GitHub: https://github.com/makeitworkcloud/ansible-project-libvirt
# Description: Creates the libvirt project in Ansible Automation Platform (AAP).
# Description: Creates the libvirt project in AWX.
# Author:
# _|
# _| _| _|_|_| _|_| _|_|_|_| _|_|
Expand All @@ -17,14 +17,12 @@
community.sops.load_vars:
file: secrets/secrets.yaml

- name: Deploy AAP content
- name: Deploy AWX content
hosts: localhost
gather_facts: false
environment:
CONTROLLER_OPTIONAL_API_URLPATTERN_PREFIX: /api/controller/
vars:
aap_project_name: libvirt
aap_organization: Default
awx_project_name: libvirt
awx_organization: Default
module_defaults:
group/awx.awx.controller:
controller_host: "{{ controller_host }}"
Expand All @@ -34,41 +32,41 @@
tasks:
- name: Create project
awx.awx.project:
name: "{{ aap_project_name }}"
name: "{{ awx_project_name }}"
description: "Managed by ansible-project-libvirt"
organization: "{{ aap_organization }}"
organization: "{{ awx_organization }}"
scm_type: git
scm_url: https://github.com/makeitworkcloud/ansible-project-libvirt.git
scm_update_on_launch: false
state: present

- name: Sync project
awx.awx.project_update:
name: "{{ aap_project_name }}"
name: "{{ awx_project_name }}"
wait: true
timeout: 300
when: not ansible_check_mode

- name: Create inventory
awx.awx.inventory:
name: "{{ aap_project_name }}"
name: "{{ awx_project_name }}"
description: "Managed by ansible-project-libvirt"
organization: "{{ aap_organization }}"
organization: "{{ awx_organization }}"
state: present

- name: Add libvirt host to inventory
awx.awx.host:
name: "{{ libvirt_host }}"
inventory: "{{ aap_project_name }}"
inventory: "{{ awx_project_name }}"
variables:
ansible_host: "{{ libvirt_fqdn }}"
state: present

- name: Create SSH credential
awx.awx.credential:
name: "{{ aap_project_name }} SSH"
name: "{{ awx_project_name }} SSH"
description: "SSH key for libvirt host"
organization: "{{ aap_organization }}"
organization: "{{ awx_organization }}"
credential_type: Machine
inputs:
username: "{{ libvirt_ssh_user }}"
Expand All @@ -77,9 +75,9 @@

- name: Create Vault credential
awx.awx.credential:
name: "{{ aap_project_name }} Vault"
name: "{{ awx_project_name }} Vault"
description: "Ansible Vault password"
organization: "{{ aap_organization }}"
organization: "{{ awx_organization }}"
credential_type: Vault
inputs:
vault_password: "{{ vault_password }}"
Expand All @@ -97,14 +95,14 @@
awx.awx.job_template:
name: "{{ item.path | basename | regex_replace('\\.ya?ml$', '') }}"
description: "Job template for {{ item.path | basename }}"
organization: "{{ aap_organization }}"
project: "{{ aap_project_name }}"
inventory: "{{ aap_project_name }}"
organization: "{{ awx_organization }}"
project: "{{ awx_project_name }}"
inventory: "{{ awx_project_name }}"
playbook: "playbooks/{{ item.path | basename }}"
job_type: run
credentials:
- "{{ aap_project_name }} SSH"
- "{{ aap_project_name }} Vault"
- "{{ awx_project_name }} SSH"
- "{{ awx_project_name }} Vault"
state: present
loop: "{{ found_playbooks.files }}"
loop_control:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ apply:
@ANSIBLE_VAULT_PASSWORD_FILE=$(ANSIBLE_VAULT_PASSWORD_FILE) ANSIBLE_LOCALHOST_WARNING=$(ANSIBLE_LOCALHOST_WARNING) ANSIBLE_INVENTORY_UNPARSED_WARNING=$(ANSIBLE_INVENTORY_UNPARSED_WARNING) ansible-playbook .setup_project.yml

commit:
@ANSIBLE_VAULT_PASSWORD_FILE=$(ANSIBLE_VAULT_PASSWORD_FILE) git commit
@ANSIBLE_VAULT_PASSWORD_FILE=$(ANSIBLE_VAULT_PASSWORD_FILE) git commit