-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
database.yml
39 lines (39 loc) · 965 Bytes
/
database.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: databases
become: yes
vars_files:
- vars/db_vars.yml
tasks:
- name: install my-sql and its dependent packages
apt:
name: "{{item}}"
state: present
with_items:
- mysql-server
- python-mysqldb
- name: start my-sql server and enable on re-boot
service:
name: mysql
state: started
enabled: yes
- name: create database schema
mysql_db:
name: "{{db_name}}"
state: present
- name: create database user
mysql_user:
name: "{{db_user_name}}"
password: "{{db_user_password}}"
priv: '*.*:ALL'
state: present
- name: copy devops.sql to db server
copy:
src: sql/devops.sql
dest: /tmp/devops.sql
- name: Import data base scripts
mysql_db:
name: online-shopping-dev
state: import
target: /tmp/devops.sql
tags:
- dbimport