--- - name: "check if database exists" stat: path: "{{ OS.database.percona.dirs.data }}/{{ mikbill.database.proper.name }}" register: database_dir - name: "create {{ mikbill.database.proper.name }} database" shell: mysql --defaults-file="{{ mikbill.dirs.tmp }}/root.cnf" -e "CREATE DATABASE {{ mikbill.database.proper.name }} DEFAULT CHARACTER SET {{ mikbill.database.proper.encoding }} COLLATE {{ mikbill.database.proper.collation }};" when: database_dir.stat.exists == False