mysql/database: Added database_template function
parent
c6309b92ad
commit
424b85eec8
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- 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"
|
||||||
|
|
||||||
|
- name: Remove SQL template from remote
|
||||||
|
file:
|
||||||
|
state: absent
|
||||||
|
path: "{{ sql_temp.path }}"
|
Loading…
Reference in New Issue