--- - meta: flush_handlers - name: Create SQL user {{ database_user }} mysql_user: state: present host: localhost user: "{{ database_user }}" password: "{{ database_pass }}" update_password: always priv: "{{ database_name }}.*:ALL" login_unix_socket: "/var/run/mysqld/mysqld.sock" - name: Create SQL database {{ database_name }} mysql_db: db: "{{ database_name }}" login_unix_socket: "/var/run/mysqld/mysqld.sock" register: create_database - name: Import SQL database template on creation include_tasks: import.yml when: create_database.changed and database_template is defined