Skip to content

Commit 5d67974

Browse files
authored
Update db-setup.yml
renamed db_password as db_pass
1 parent 3d29a3e commit 5d67974

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ansible/db-setup.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
loop:
2525
- { key: "DB_HOST", value: "{{ db_host }}" }
2626
- { key: "DB_USER", value: "{{ db_user }}" }
27-
- { key: "DB_PASS", value: "{{ db_password }}" }
27+
- { key: "DB_PASS", value: "{{ db_pass }}" }
2828
- { key: "DB_NAME", value: "{{ db_name }}" }
2929
no_log: true
3030

@@ -69,8 +69,9 @@
6969
fail:
7070
msg: "Failed to create database '{{ db_name }}'. Connection or permissions issue."
7171
when: >
72-
"'success' not in create_db.stdout" and
73-
db_check.stdout.find(db_name) == -1
72+
create_db is defined and db_check is defined and
73+
('success' not in (create_db.stdout | default(''))) and
74+
((db_check.stdout | default('')).find(db_name) == -1)
7475
no_log: false
7576

7677
rescue:
@@ -82,7 +83,7 @@
8283
- name: Load MySQL initialization script (run once)
8384
run_once: true
8485
shell: |
85-
mysql -h {{ db_host }} -u{{ db_user }} -p'{{ db_password }}' {{ db_name }} < {{ remote_mysql_script_path }}
86+
mysql -h {{ db_host }} -u{{ db_user }} -p'{{ db_pass }}' {{ db_name }} < {{ remote_mysql_script_path }}
8687
args:
8788
executable: /bin/bash
8889
changed_when: false
@@ -91,7 +92,7 @@
9192
- name: Verify database initialization
9293
run_once: true
9394
shell: |
94-
mysql -h "{{ db_host }}" -u"{{ db_user }}" -p"{{ db_password }}" "{{ db_name }}" -e "SHOW TABLES;"
95+
mysql -h "{{ db_host }}" -u"{{ db_user }}" -p"{{ db_pass }}" "{{ db_name }}" -e "SHOW TABLES;"
9596
register: db_check
9697
changed_when: false
9798
when: db_load_result.rc == 0

0 commit comments

Comments
 (0)