-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmysql.yml
39 lines (37 loc) · 982 Bytes
/
mysql.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
38
39
- hosts: vm
gather_facts: False
remote_user: ramu
become: yes
vars:
mysql_root_password: test
tasks:
- name: Apt update
apt: update_cache=yes
- name: Install Mysql
apt: name={{ item }} state=present
with_items:
- python-mysqldb
- mysql-server
# - name: update mysql root password for all root accounts
# mysql_user:
# name: root
# host: "{{ item }}"
# password: "{{ mysql_root_password }}"
# priv: "*.*:ALL,GRANT"
# with_items:
# - "{{ vm_host }}"
# - 127.0.0.1
# - ::1
# - localhost
- name: Copy the root credentials as .my.cnf file
template: src=root.cnf.j2 dest=~/.my.cnf mode=0600
- name: create database
mysql_user:
login_user: root
login_password: test
name: bob
password: 12345
priv: '*.*:ALL'
state: present
- name: Create DB
mysql_db: name=db1 state=present