-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yml
116 lines (110 loc) · 3.52 KB
/
main.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
- hosts: 127.0.0.1
sudo: yes
vars:
- ruby_version: 2.2.0
tasks:
- name: yum update
yum: name=* state=latest
- name: disable firewalld
service: name=firewalld state=stopped enabled=no
- name: install libselinux-python
yum: name=libselinux-python state=latest
- name: change timezone
command: timedatectl set-timezone Asia/Tokyo
- name: change locale
command: sed -i "s/en_US/ja_JP/g" /etc/locale.conf
- name: install remi repository
command: rpm -Uvh --force http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
- name: install apache
yum: name=httpd state=latest
- name: start apache and enabled
service: name=httpd state=started enabled=yes
- name: change owner
file: dest=/var/www/html owner=vagrant recurse=yes
- name: install php
yum: name={{item}} enablerepo=remi,epel state=present
with_items:
- php
- php-devel
- php-mysql
- php-mbstring
- php-gd
notify:
- restart apache
- name: copy php.ini.custom
copy: src=php.ini.custom dest=/etc/php.ini backup=yes
notify:
- restart apache
- name: install mariadb
yum: name=mariadb-server enablerepo=remi,epel state=present
- name: copy my.cnf.custom
copy: src=my.cnf.custom dest=/etc/my.cnf backup=yes
- name: start mariadb and enabled
service: name=mariadb state=started enabled=yes
- name: install ruby dependencies
yum: name={{item}} enablerepo=remi,epel state=present
with_items:
- gcc
- openssl-devel
- rpm-build
- gcc-c++
- bzip2
- libtool
- zlib
- zlib-devel
- httpd-devel
- openssl-devel
- curl-devel
- ncurses-devel
- gdbm-devel
- readline
- readline-devel
- sqlite-devel
- libyaml-devel
- libffi-devel
- bison
- name: check rbenv installed
command: test -x /home/vagrant/.rbenv
register: rbenv_present
ignore_errors: yes
sudo: no
- name: git clone rbenv
git: repo=https://github.com/sstephenson/rbenv.git dest=/home/vagrant/.rbenv
when: rbenv_present.rc != 0
sudo: no
- name: update bash_profile
copy: src=bash_profile.custom dest=/home/vagrant/.bash_profile backup=yes
sudo: no
- name: check ruby-build installed
command: test -x /home/vagrant/.rbenv/plugins/ruby-build
register: rbuild_present
ignore_errors: yes
sudo: no
- name: git clone ruby-build
git: repo=https://github.com/sstephenson/ruby-build.git dest=/home/vagrant/.rbenv/plugins/ruby-build
when: rbuild_present.rc != 0
sudo: no
- name: check ruby installed
shell: /bin/bash -lc "rbenv versions | grep {{ruby_version}}"
register: ruby_installed
ignore_errors: yes
sudo: no
- name: install ruby
shell: /bin/bash -lc "rbenv install {{ruby_version}} && rbenv rehash && rbenv global {{ruby_version}}"
when: ruby_installed.rc != 0
sudo: no
- name: check node js installed
shell: /bin/bash -lc "node -v"
register: node_installed
ignore_errors: yes
sudo: no
- name: install node script
shell: /bin/bash -lc "curl -sL https://rpm.nodesource.com/setup | bash -"
when: node_installed.rc != 0
- name: install nodejs
yum: name=nodejs state=latest
when: node_installed.rc != 0
handlers:
- name: restart apache
service: name=httpd state=restarted