feature: add ansible foundation and connectivity check
Checks / Secret Scan (pull_request) Successful in 5s
Checks / Lint (pull_request) Successful in 9s

First read-only run on the dedicated ansible runner proves the inventory, SSH access and Docker on the docker host before any stack is adopted.
This commit is contained in:
kasun committed 2026-11-25 20:20:37 +01:00
1 parent 6d404e2b21
commit 2d24f767e1
7 files changed
+81 -1

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
name: Check Connectivity
on:
workflow_dispatch:
jobs:
check-connectivity:
name: Check Connectivity
runs-on: ansible
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Show Ansible Version
run: ansible-playbook --version
- name: Run Connectivity Playbook
run: ansible-playbook playbooks/check-connectivity.yml
+1 -1
View File
@@ -9,7 +9,7 @@ Ansible automation for a Proxmox homelab. It deploys Docker stacks and single sc
## Layout (planned) ## Layout (planned)
`inventory/hosts.yml`, `group_vars/`, `roles/{docker_stack,script,lxc_base}`, `stacks/<service>/{docker-compose.yml,env.j2}`, `scripts/`, `playbooks/`, `.gitea/workflows/`. `inventory/{hosts.yml,group_vars/}`, `roles/{docker_stack,script,lxc_base}`, `stacks/<service>/{docker-compose.yml,env.j2}`, `scripts/`, `playbooks/`, `.gitea/workflows/`.
## Deployment flow ## Deployment flow
+9
View File
@@ -0,0 +1,9 @@
[defaults]
inventory = inventory/hosts.yml
roles_path = roles
host_key_checking = True
interpreter_python = auto_silent
retry_files_enabled = False
[ssh_connection]
pipelining = True
+3
View File
@@ -0,0 +1,3 @@
---
# Compose derives each project name from its folder, so these paths must not change.
homelab_stacks_root: /home/pi/docker
+11
View File
@@ -0,0 +1,11 @@
---
# On the ansible LXC, ~/.ssh/config maps "docker" to its real address, user and key.
all:
children:
control:
hosts:
ansible:
ansible_connection: local
docker_hosts:
hosts:
docker:
+35
View File
@@ -0,0 +1,35 @@
---
# Read-only: proves Ansible can reach each host. It changes nothing.
- name: Check that every host responds
hosts: all
gather_facts: false
tasks:
- name: Ping host
ansible.builtin.ping:
- name: Check the Docker host
hosts: docker_hosts
gather_facts: false
tasks:
- name: Read Docker Compose version
ansible.builtin.command: docker compose version
register: check_connectivity_compose
changed_when: false
check_mode: false
- name: Show Docker Compose version
ansible.builtin.debug:
msg: "{{ check_connectivity_compose.stdout }}"
- name: Read stacks root
ansible.builtin.stat:
path: "{{ homelab_stacks_root }}"
register: check_connectivity_stacks_root
- name: Require stacks root
ansible.builtin.assert:
that:
- check_connectivity_stacks_root.stat.isdir is defined
- check_connectivity_stacks_root.stat.isdir
fail_msg: "{{ homelab_stacks_root }} is missing or is not a directory"
quiet: true
+4
View File
@@ -0,0 +1,4 @@
---
# Template only. The real file is /etc/homelab-ansible/vault.yml on the ansible LXC,
# encrypted with ansible-vault and never committed.
vault_example_secret: CHANGE_ME