Skip to content

Commit 82c1273

Browse files
committed
fix #73: Fails late if no secrets defined
1 parent ea3155a commit 82c1273

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- name: Assert secrets created
2+
assert:
3+
that: (hostvars[inventory_hostname].keys() | select('contains', 'vault_') | length) > 1 # 1 as may have vault_testuser_password defined in dev
4+
fail_msg: "No inventory variables 'vault_*' found: Has ansible/adhoc/generate-passwords.yml been run"

ansible/site.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
when: hook_path | exists
1010

1111
- import_playbook: validate.yml
12-
when: "{{ appliances_validate | default(true) }}"
12+
when: appliances_validate | default(true)
1313

1414
- import_playbook: bootstrap.yml
1515

ansible/validate.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
# Fail early if configuration is invalid
44

5+
- name: Validate secrets created
6+
hosts: localhost
7+
gather_facts: false
8+
tasks:
9+
- import_role:
10+
name: passwords
11+
tasks_from: validate.yml
12+
513
- name: Ensure control node is in inventory
614
hosts: all
715
gather_facts: false

0 commit comments

Comments
 (0)