Add ruby role

This commit is contained in:
staticsafe 2017-11-24 15:08:51 -05:00
parent 165d4516ad
commit 8a3fd461c8
2 changed files with 39 additions and 0 deletions

38
roles/ruby/tasks/main.yml Normal file
View File

@ -0,0 +1,38 @@
---
# All tasks in this role should be done as the mastodon user
- name: Clone rbenv git repository
git:
repo: 'https://github.com/rbenv/rbenv.git'
dest: /home/mastodon/.rbenv
become: true
become_user: mastodon
- name: Install rbenv
shell: cd ~/.rbenv && src/configure && make -C src
args:
executable: /bin/bash
become: true
become_user: mastodon
- name: Add rbenv to PATH
shell: echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
args:
executable: /bin/bash
become: true
become_user: mastodon
- name: Add rbenv to shell startup
shell: echo 'eval "$(rbenv init -)"' >> ~/.bashrc
args:
executable: /bin/bash
become: true
become_user: mastodon
- name: Install ruby-build as rbenv plugin
git:
repo: 'https://github.com/rbenv/ruby-build.git'
dest: /home/mastodon/.rbenv/plugins/ruby-build
become: true
become_user: mastodon
- name: Install Ruby and set it as the user's default
shell: rbenv install 2.4.2 && rbenv global 2.4.2
args:
executable: /bin/bash
become: true
become_user: mastodon

View File

@ -3,3 +3,4 @@
hosts: mastodon
roles:
- common
- ruby