forked from vcian/ansible-php-nginx-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
03_database_user.yml
executable file
·37 lines (32 loc) · 1.07 KB
/
03_database_user.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
- hosts: test # Add Ansible Host name based on /etc/ansible/hosts
remote_user: ubuntu # Add here Remote User-name
become: true
vars:
mysql_root_username: root # MySQL Current Root Username
mysql_root_password: admin@123 # MySQL Current Root User Password
vars_prompt:
- name: UserName
prompt: "Enter Mysql Username For Newuser"
private: false
- name: PassWord
prompt: "Enter Mysql Password For Newuser"
private: false
- name: DbName
prompt: "Enter Mysql Database Name"
private: false
tasks:
- name: Create New Database
community.mysql.mysql_db:
login_user: "{{ mysql_root_username }}"
login_password: "{{ mysql_root_password }}"
db: "{{ DbName }}"
state: present
- name: Create New User
community.mysql.mysql_user:
name: "{{ UserName }}"
password: "{{ PassWord }}"
login_user: "{{ mysql_root_username }}"
login_password: "{{ mysql_root_password }}"
priv: "{{ DbName }}.*:ALL"
state: present