File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 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
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 :
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
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
You can’t perform that action at this time.
0 commit comments