From 8a3fd461c8a8797adfb625bcbf4c2e4ac5f6c707 Mon Sep 17 00:00:00 2001 From: staticsafe Date: Fri, 24 Nov 2017 15:08:51 -0500 Subject: [PATCH] Add ruby role --- roles/ruby/tasks/main.yml | 38 ++++++++++++++++++++++++++++++++++++++ site.yml | 1 + 2 files changed, 39 insertions(+) create mode 100644 roles/ruby/tasks/main.yml diff --git a/roles/ruby/tasks/main.yml b/roles/ruby/tasks/main.yml new file mode 100644 index 0000000..306b3af --- /dev/null +++ b/roles/ruby/tasks/main.yml @@ -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 diff --git a/site.yml b/site.yml index d84509f..0f562b9 100644 --- a/site.yml +++ b/site.yml @@ -3,3 +3,4 @@ hosts: mastodon roles: - common + - ruby