Skip to content
This repository was archived by the owner on Nov 12, 2024. It is now read-only.

Commit c6af731

Browse files
committed
Ensure that the environment variable DB_PASS is set
1 parent 83c4de9 commit c6af731

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

provision.yml

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
#!/usr/bin/env ansible-playbook
2-
# export DB_PASS=RandomPostgresWords
2+
# export DB_PASS=aVeryStrongDatabasePassword
33
---
44

55
- name: Database Server
66
hosts: database
77
become: true
88
gather_facts: true
9+
tags: [postgres]
10+
11+
pre_tasks:
12+
- name: Lookup DB_PASS in environment variables
13+
ansible.builtin.set_fact:
14+
check_db_pass: "{{ lookup('env', 'DB_PASS') }}"
15+
16+
- name: Assert that DB_PASS is defined
17+
ansible.builtin.assert:
18+
that:
19+
- check_db_pass | length > 8
20+
msg: |
21+
run this shell command before this playbook:
22+
export DB_PASS=aVeryStrongDatabasePassword
923
1024
roles:
1125
- role: postgres
12-
tags: [postgres]
1326

1427
- name: Semaphore in Docker
1528
hosts: semaphore

0 commit comments

Comments
 (0)