forked from OSDLabs/swd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook.yml
83 lines (66 loc) · 2.19 KB
/
playbook.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
- hosts: all
become: true
vars:
mysql_swd_password: swd_base
tasks:
- name: 'check bash setup'
shell: grep -Fxq "PS1='\[\e[0;31m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] $ '" /home/vagrant/.bashrc
register: ps
ignore_errors: true
- name: set up bash
shell: bash vagrant_support/install.sh
when: ps|failed
- name: install epel-release
yum: name=epel-release state=present
- name: install node
yum: name=nodejs state=present
- name: install wget
yum: name=wget state=present
- name: setup for yarn
shell: wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo
- name: install yarn
yum: name=yarn state=present
- name: install swd dependencies
shell: yarn install
- name: install mariadb
yum:
name: mariadb-server
state: present
- name: install the python mysql support libraries
yum: pkg=MySQL-python state=latest
- name: start mariadb server and enable it on reboot
service: name=mariadb state=started enabled=true
- name: update mariadb root user
mysql_user:
name: root
host: localhost
password: "{{ mysql_swd_password }}"
login_user: root
login_password: "{{ mysql_swd_password }}"
check_implicit_admin: yes
priv: "*.*:ALL,GRANT"
- name: copy the root credentials as .my.cnf file
template:
src: vagrant_support/root.cnf.j2
dest: ~/.my.cnf
mode: 0600
- name: restarting mariadb
service:
name: mariadb
state: restarted
- name: update mariadb swd user
mysql_user:
name: swd
host: localhost
password: "{{ mysql_swd_password }}"
login_user: root
login_password: "{{ mysql_swd_password }}"
priv: "*.*:ALL,GRANT"
- name: 'check for db_swd (failure is ok)'
shell: mysql -u "swd" --password="{{ mysql_swd_password }}" -e "show databases" | grep db_swd
register: db_swd
ignore_errors: true
- name: create a db_swd database
mysql_db: name=db_swd state=present login_user=swd login_password="{{ mysql_swd_password }}"
when: db_swd|failed