Skip to content

Commit a32d2a1

Browse files
committed
execute checks during deploy too
1 parent ef82f90 commit a32d2a1

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
lines changed

src/ansible.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[defaults]
22
host_key_checking = False
33
roles_path = ~/.ansible/roles:./roles
4+
callback_result_format = yaml

src/playbooks/checks/checks.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@
33
hosts: quadlet
44
gather_facts: true
55
roles:
6-
- check_subuid_subgid
7-
- check_hostname
6+
- checks

src/playbooks/deploy/deploy.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
- python3-psycopg2
5151
- python3-requests
5252
roles:
53+
- role: checks
5354
- role: certificates
5455
when: "certificate_source == 'default'"
5556
- role: certificate_checks
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
- name: Check role block
2+
block:
3+
- name: Execute check role
4+
ansible.builtin.include_role:
5+
name: "{{ item }}"
6+
rescue:
7+
- name: Record check result
8+
ansible.builtin.set_fact:
9+
checks_results: "{{ (checks_results | default([])) + [ansible_failed_result] }}"

src/roles/checks/tasks/main.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- name: Execute checks
3+
ansible.builtin.include_tasks: execute_check.yml
4+
loop:
5+
- check_hostname
6+
7+
- name: Report status of checks
8+
ansible.builtin.fail:
9+
msg: "{{ checks_results }}"
10+
when:
11+
- checks_results|default([])|length > 0

0 commit comments

Comments
 (0)