Handle unexpected database presence
Check for database presence in a nice way, rather than dropping the database. Thankfully there was a syntax error in the previous version, so no database would have been dropped. There was no check for whether it succeeded or not.
This commit is contained in:
parent
f1db99caa7
commit
4f3430ebeb
1 changed files with 3 additions and 2 deletions
|
@ -19,8 +19,9 @@
|
||||||
# ============================================================
|
# ============================================================
|
||||||
|
|
||||||
- name: make sure the test database is not there
|
- name: make sure the test database is not there
|
||||||
command: mysql "-e drop database '{{db_name}}';"
|
command: mysql {{db_name}}
|
||||||
ignore_errors: True
|
register: mysql_db_check
|
||||||
|
failed_when: "'1049' not in mysql_db_check.stderr"
|
||||||
|
|
||||||
- name: test state=present for a database name (expect changed=true)
|
- name: test state=present for a database name (expect changed=true)
|
||||||
mysql_db: name={{ db_name }} state=present
|
mysql_db: name={{ db_name }} state=present
|
||||||
|
|
Loading…
Reference in a new issue