-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmain.yml
200 lines (188 loc) · 6.24 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
---
- hosts: localhost
become: yes
vars:
- ruby_version: 2.3.1
- python_version: 3.5.2
tasks:
- name: disable iptables
service: name=iptables state=stopped enabled=no
- name: install libselinux-python
yum: name=libselinux-python state=latest
- name: Disabled SELinux
selinux:
state: disabled
- name: remove localtime
file: path=/etc/localtime state=absent
- name: change timezone
file: src=/usr/share/zoneinfo/Asia/Tokyo dest=/etc/localtime state=link force=yes mode=0644
- name: install remi repository
command: rpm -Uvh --force http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
- name: install man
yum: name=man state=latest
- 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: copy httpd.conf
copy: src=httpd.conf.custom dest=/etc/httpd/conf/httpd.conf backup=yes
notify:
- restart apache
- name: install gd-last
yum: name=gd-last enablerepo=remi state=latest
- name: install php
yum:
name:
- php
- php-common
- php-pdo
- php-cli
- php-devel
- php-mysqlnd
- php-mbstring
- php-gd
- php-intl
- php-xml
enablerepo: remi-php56
state: present
notify:
- restart apache
- name: copy php.ini.custom
copy: src=php.ini.custom dest=/etc/php.ini backup=yes
notify:
- restart apache
- name: install mysql repository
command: rpm -Uvh --force http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
- name: install mysql
yum:
name:
- mysql
- mysql-devel
- mysql-server
- mysql-utilities
state: present
- name: copy my.cnf.custom
copy: src=my.cnf.custom dest=/etc/my.cnf backup=yes
- name: start mysql and enabled
service: name=mysqld state=started enabled=yes
- name: install ruby dependencies
yum:
name:
- gcc
- openssl
- openssl-devel
- rpm-build
- gcc-c++
- bzip2
- bzip2-devel
- libtool
- zlib
- zlib-devel
- httpd-devel
- openssl-devel
- curl-devel
- ncurses-devel
- gdbm-devel
- readline
- readline-devel
- sqlite
- sqlite-devel
- libyaml-devel
- libffi-devel
- bison
enablerepo: remi,epel
state: present
- name: check rbenv installed
command: test -x /home/vagrant/.rbenv
register: rbenv_present
become: no
failed_when: rbenv_present.rc not in [0, 1]
- name: git clone rbenv
git: repo=https://github.com/sstephenson/rbenv.git dest=/home/vagrant/.rbenv
when: rbenv_present.rc == 1
become: no
- name: update bash_profile
copy: src=bash_profile.custom dest=/home/vagrant/.bash_profile backup=yes
become: no
- name: check ruby-build installed
command: test -x /home/vagrant/.rbenv/plugins/ruby-build
register: rbuild_present
become: no
failed_when: rbuild_present.rc not in [0, 1]
- 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 == 1
become: no
- name: update rbenv
command: git pull --rebase chdir=/home/vagrant/.rbenv
become: no
- name: update ruby-build
command: git pull --rebase chdir=/home/vagrant/.rbenv/plugins/ruby-build
become: no
- name: check ruby installed
shell: /bin/bash -lc "rbenv versions | grep {{ruby_version}}"
register: ruby_installed
become: no
failed_when: ruby_installed.rc not in [0, 1]
- name: install ruby
shell: /bin/bash -lc "rbenv install {{ruby_version}} && rbenv rehash && rbenv global {{ruby_version}}"
when: ruby_installed.rc == 1
become: no
- name: check pyenv installed
command: test -x /home/vagrant/.pyenv
register: pyenv_present
become: no
failed_when: pyenv_present.rc not in [0, 1]
- name: git clone pyenv
git: repo=https://github.com/yyuu/pyenv.git dest=/home/vagrant/.pyenv
when: pyenv_present.rc == 1
become: no
- name: check pyvirtual installed
command: test -x /home/vagrant/.pyenv/plugins/pyenv-virtualenv
register: pyvirtual_present
become: no
failed_when: pyvirtual_present.rc not in [0, 1]
- name: git clone pyenv-virtual
git: repo=https://github.com/yyuu/pyenv-virtualenv.git dest=/home/vagrant/.pyenv/plugins/pyenv-virtualenv
when: pyvirtual_present.rc == 1
become: no
- name: update pyenv
command: git pull --rebase chdir=/home/vagrant/.pyenv
become: no
- name: update pyenv-virtualenv
command: git pull --rebase chdir=/home/vagrant/.pyenv/plugins/pyenv-virtualenv
become: no
- name: check python installed
shell: /bin/bash -lc "pyenv versions | grep {{python_version}}"
register: python_installed
become: no
failed_when: python_installed.rc not in [0, 1]
- name: install python
shell: /bin/bash -lc "pyenv install {{python_version}} && pyenv rehash && pyenv global {{python_version}}"
when: python_installed.rc == 1
become: no
- name: check node js installed
shell: /bin/bash -lc "node -v"
register: node_installed
become: no
failed_when: node_installed.rc not in [0, 1, 127]
- name: install node script
shell: /bin/bash -lc "curl -sL https://rpm.nodesource.com/setup | bash -"
when: node_installed.rc == 127
- name: install nodejs
yum: name=nodejs state=latest
when: node_installed.rc == 127
- name: install npm
yum: name=npm state=latest
when: node_installed.rc == 127
- name: change locale
lineinfile: >-
dest=/etc/sysconfig/i18n
state=present
regexp=^LANG=
line='LANG="ja_JP.UTF-8"'
handlers:
- name: restart apache
service: name=httpd state=restarted