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.
36 lines
1.0 KiB
YAML
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
|