Symlink the binaries when doing a system install

This commit is contained in:
Nick Janetakis
2014-09-20 12:16:44 -04:00
parent 027f7e8c1a
commit ea043de365
3 changed files with 40 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
---
- name: Detect if rubies are installed
command: '{{ rvm1 }} {{ item }} do true'
command: '{{ rvm1_rvm }} {{ item }} do true'
changed_when: False
failed_when: False
register: detect_rubies
@@ -9,36 +9,38 @@
when: rvm1_rubies
- name: Install rubies
command: '{{ rvm1 }} install {{ item.item }}'
command: '{{ rvm1_rvm }} install {{ item.item }}'
when: rvm1_rubies and item.rc != 0
with_items: detect_rubies.results
- name: Detect default ruby version
command: '{{ rvm1 }} alias list default'
command: '{{ rvm1_rvm }} alias list default'
changed_when: False
register: detect_default_ruby_version
- name: Select default ruby
command: '{{ rvm1 }} alias create default {{ rvm1_default_ruby_version }}'
command: '{{ rvm1_rvm }} alias create default {{ rvm1_default_ruby_version }}'
when: detect_default_ruby_version.stdout == '' or
rvm1_default_ruby_version not in detect_default_ruby_version.stdout
- name: Set rvm install path permissions
- name: Symlink ruby related binaries on the system path
file:
path: '{{ rvm1_install_path }}'
state: 'directory'
recurse: True
owner: '{{ rvm1_user }}'
group: '{{ rvm1_group }}'
state: 'link'
src: '{{ rvm1_install_path }}/wrappers/default/{{ item }}'
dest: '{{ rvm1_symlink_to }}/{{ item }}'
owner: 'root'
group: 'root'
when: not '--user-install' in rvm1_install_flags
with_items: rvm1_symlink_binaries
- name: Detect if ruby version can be deleted
command: '{{ rvm1 }} {{ rvm1_delete_ruby }} do true'
command: '{{ rvm1_rvm }} {{ rvm1_delete_ruby }} do true'
changed_when: False
failed_when: False
register: detect_delete_ruby
when: rvm1_delete_ruby
- name: Delete ruby version
command: '{{ rvm1 }} remove {{ rvm1_delete_ruby }}'
command: '{{ rvm1_rvm }} remove {{ rvm1_delete_ruby }}'
changed_when: False
when: rvm1_delete_ruby and detect_delete_ruby.rc == 0

View File

@@ -1,7 +1,7 @@
---
- name: Detect rvm binary
stat: path='{{ rvm1 }}'
stat: path='{{ rvm1_rvm }}'
register: rvm_binary
- name: Detect rvm installer
@@ -9,7 +9,7 @@
register: rvm_installer
- name: Detect current rvm version
command: '{{ rvm1 }} version'
command: '{{ rvm1_install_path }} version'
changed_when: False
register: rvm_current_version
when: rvm_binary.stat.exists
@@ -35,16 +35,15 @@
- name: Install rvm stable
command: >
{{ rvm1_temp_download_path }}/rvm-installer.sh
--path {{ rvm1_install_path }}
--auto-dotfiles stable
{{ rvm1_temp_download_path }}/rvm-installer.sh stable
--path {{ rvm1_install_path }} {{ rvm1_install_flags }}
when: not rvm_binary.stat.exists
- name: Update rvm
shell: '{{ rvm1 }} get stable && {{ rvm1 }} reload'
shell: '{{ rvm1_rvm }} get stable && {{ rvm1_rvm }} reload'
when: rvm_binary.stat.exists and
rvm_stable_version_number.content | default(rvm1_rvm_stable_version_number) | replace('\n', '') > rvm_current_version.stdout.split()[1]
- name: Configure rvm
command: '{{ rvm1 }} autolibs 3'
command: '{{ rvm1_rvm }} autolibs 3'
when: not rvm_binary.stat.exists

View File

@@ -1,8 +1,22 @@
---
rvm1_temp_download_path: '/tmp'
rvm1_default_ruby_version: '{{ rvm1_rubies | last if rvm1_rubies and rvm1_rubies is iterable else "" }}'
rvm1: '{{ rvm1_install_path }}/bin/rvm'
rvm1_default_wrappers: '{{ rvm1_install_path }}/wrappers/default'
rvm1_ruby: '{{ rvm1_default_wrappers }}/ruby'
rvm1_gem: '{{ rvm1_default_wrappers }}/gem'
rvm1_bundle: '{{ rvm1_default_wrappers }}/bundle'
rvm1_rake: '{{ rvm1_bundle }} exec rake'
rvm1_rvm: '{{ rvm1_install_path }}/bin/rvm'
rvm1_symlink_binaries:
- 'bundle'
- 'bundler'
- 'erb'
- 'executable-hooks-uninstaller'
- 'gem'
- 'irb'
- 'rake'
- 'rdoc'
- 'ri'
- 'ruby'
- 'testrb'
rvm1_symlink_to: '/usr/local/bin'