-
Notifications
You must be signed in to change notification settings - Fork 1
/
ruby.yml
78 lines (64 loc) · 1.6 KB
/
ruby.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
- name: Remove system default ruby
apt:
name: ruby
state: absent
- name: Get rbenv from GitHub
git:
repo: https://github.com/rbenv/rbenv.git
dest: /opt/rbenv
- name: Configure rbenv
shell: ./configure
args:
chdir: /opt/rbenv/src
- name: Make rbenv
shell: make -C src
args:
chdir: /opt/rbenv
- name: Add RBENV_ROOT
lineinfile:
create: yes
state: present
dest: /etc/bash.bashrc
line: 'export RBENV_ROOT="/opt/rbenv"'
- name: Update PATH for rbenv
lineinfile:
state: present
dest: /etc/bash.bashrc
line: 'export PATH="/opt/rbenv/bin:$PATH" && eval "$(rbenv init -)"'
- name: Get ruby-build from GitHub
git:
repo: https://github.com/rbenv/ruby-build.git
dest: /opt/rbenv/plugins/ruby-build
- name: Install ruby dependency
apt:
name: libreadline-dev
state: present
- name: Install ruby
shell: export RBENV_ROOT="/opt/rbenv"; /opt/rbenv/bin/rbenv install -s 2.4.0
become: yes
- name: Create link from /usr/bin/ruby
file:
src: /opt/rbenv/shims/ruby
dest: /usr/bin/ruby
state: link
become: yes
- name: Create link from /usr/bin/gem
file:
src: /opt/rbenv/shims/gem
dest: /usr/bin/gem
state: link
become: yes
- name: Set rbenv
shell: export RBENV_ROOT="/opt/rbenv"; /opt/rbenv/bin/rbenv global 2.4.0
become: yes
- name: Update PATH for gem
lineinfile:
state: present
dest: /etc/bash.bashrc
line: 'PATH="`ruby -e "puts Gem.user_dir"`/bin:$PATH"'
- name: Install gems
gem: name={{item}} state=present executable=/opt/rbenv/shims/gem
with_items:
- rails
- railties
- bundler