You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
590 B
YAML

---
- name: Generate temporary filename
tempfile:
state: file
suffix: .sql
register: sql_temp
- name: Copy SQL template to remote
copy:
content: "{{ database_template }}"
dest: "{{ sql_temp.path }}"
- name: Import SQL database template on creation
mysql_db:
state: import
name: "{{ database_name }}"
target: "{{ sql_temp.path }}"
login_unix_socket: "/var/run/mysqld/mysqld.sock"
login_user: root
login_password: "{{ mysql_root_password }}"
- name: Remove SQL template from remote
file:
state: absent
path: "{{ sql_temp.path }}"