Files
homelab-ansible/playbooks/check-connectivity.yml
T
kasun 2d24f767e1
Checks / Secret Scan (pull_request) Successful in 5s
Checks / Lint (pull_request) Successful in 9s
feature: add ansible foundation and connectivity check
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.
2026-11-25 20:20:37 +01:00

36 lines
1.0 KiB
YAML

---
# 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