Skip to content

Commit

Permalink
Ensure that the environment variable DB_PASS is set
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaassssiiee committed Nov 11, 2024
1 parent 83c4de9 commit c6af731
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions provision.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
#!/usr/bin/env ansible-playbook
# export DB_PASS=RandomPostgresWords
# export DB_PASS=aVeryStrongDatabasePassword
---

- name: Database Server
hosts: database
become: true
gather_facts: true
tags: [postgres]

pre_tasks:
- name: Lookup DB_PASS in environment variables
ansible.builtin.set_fact:
check_db_pass: "{{ lookup('env', 'DB_PASS') }}"

- name: Assert that DB_PASS is defined
ansible.builtin.assert:
that:
- check_db_pass | length > 8
msg: |
run this shell command before this playbook:
export DB_PASS=aVeryStrongDatabasePassword
roles:
- role: postgres
tags: [postgres]

- name: Semaphore in Docker
hosts: semaphore
Expand Down

0 comments on commit c6af731

Please sign in to comment.