52 lines
1.5 KiB
YAML
52 lines
1.5 KiB
YAML
- name: "04-14 noop verify"
|
|
hosts: k3s_server
|
|
become: true
|
|
run_once: true
|
|
vars:
|
|
doc_id: "04-14"
|
|
repo_root: "/root/Deploy-Laboratory"
|
|
k3s_kubeconfig: /etc/rancher/k3s/k3s.yaml
|
|
tasks:
|
|
- name: Find docs file by doc_id prefix
|
|
ansible.builtin.find:
|
|
paths: "{{ repo_root }}/docs"
|
|
patterns: "{{ doc_id }}-*.md"
|
|
file_type: file
|
|
use_regex: false
|
|
register: _docs_found
|
|
delegate_to: localhost
|
|
become: false
|
|
|
|
- name: Fail when docs file missing
|
|
ansible.builtin.assert:
|
|
that:
|
|
- _docs_found.matched | int >= 1
|
|
fail_msg: "docs file missing by prefix: docs/{{ doc_id }}-*.md"
|
|
delegate_to: localhost
|
|
become: false
|
|
|
|
- name: Assert ansible/files doc_id directory exists
|
|
ansible.builtin.stat:
|
|
path: "{{ repo_root }}/ansible/files/{{ doc_id }}"
|
|
register: _files_dir
|
|
delegate_to: localhost
|
|
become: false
|
|
|
|
- name: Fail when ansible/files doc_id directory missing
|
|
ansible.builtin.assert:
|
|
that:
|
|
- _files_dir.stat.exists
|
|
- _files_dir.stat.isdir
|
|
fail_msg: "ansible/files missing doc_id directory: ansible/files/{{ doc_id }}"
|
|
delegate_to: localhost
|
|
become: false
|
|
|
|
- name: Verify cluster reachable (kubectl get nodes)
|
|
ansible.builtin.shell: |
|
|
set -euo pipefail
|
|
KUBECONFIG={{ k3s_kubeconfig }} kubectl get nodes
|
|
args:
|
|
executable: /bin/bash
|
|
changed_when: false
|
|
|