Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #73: Fails late if no secrets defined #329

Merged
merged 4 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ansible/roles/passwords/tasks/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Assert secrets created
assert:
that: (hostvars[inventory_hostname].keys() | select('contains', 'vault_') | length) > 1 # 1 as may have vault_testuser_password defined in dev
fail_msg: "No inventory variables 'vault_*' found: Has ansible/adhoc/generate-passwords.yml been run?"
2 changes: 1 addition & 1 deletion ansible/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
when: hook_path | exists

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

- import_playbook: bootstrap.yml

Expand Down
8 changes: 8 additions & 0 deletions ansible/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

# Fail early if configuration is invalid

- name: Validate secrets created
hosts: localhost
gather_facts: false
tasks:
- import_role:
name: passwords
tasks_from: validate.yml

- name: Ensure control node is in inventory
hosts: all
gather_facts: false
Expand Down
2 changes: 1 addition & 1 deletion environments/common/layouts/everything
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ control
[filebeat:children]
slurm_stats

# NB: [rebuild] not defined here as this template is used in CI, which does not run in openstack
# NB: [rebuild] not defined here as this template is used in CI

[update:children]
cluster
Expand Down
Loading