39 lines
732 B
YAML
39 lines
732 B
YAML
---
|
|
- hosts: all
|
|
become: true
|
|
|
|
|
|
tasks:
|
|
- name: installation extensions python
|
|
apt:
|
|
name: python3-pymysql
|
|
state: present
|
|
|
|
- name: Create a new database
|
|
community.mysql.mysql_db:
|
|
name: sdis29
|
|
state: present
|
|
login_unix_socket: /run/mysqld/mysqld.sock
|
|
|
|
- name: Create a new user
|
|
community.mysql.mysql_user:
|
|
name: admin
|
|
password: Azerty1+
|
|
priv: 'sdis29.*:ALL'
|
|
state: present
|
|
login_unix_socket: /run/mysqld/mysqld.sock
|
|
|
|
- name:
|
|
copy:
|
|
src: sdis29.sql
|
|
dest: /tmp/
|
|
|
|
|
|
|
|
- name: Import database
|
|
community.mysql.mysql_db:
|
|
name: my_db
|
|
state: import
|
|
target: /tmp/sdis29.sql
|
|
login_unix_socket: /run/mysqld/mysqld.sock
|