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.
This commit is contained in:
1 parent
6d404e2b21
commit
2d24f767e1
7 files changed
+81
-1
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user