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

View File

@@ -1,7 +1,7 @@
--- ---
- name: Detect rvm binary - name: Detect rvm binary
stat: path='{{ rvm1 }}' stat: path='{{ rvm1_rvm }}'
register: rvm_binary register: rvm_binary
- name: Detect rvm installer - name: Detect rvm installer
@@ -9,7 +9,7 @@
register: rvm_installer register: rvm_installer
- name: Detect current rvm version - name: Detect current rvm version
command: '{{ rvm1 }} version' command: '{{ rvm1_install_path }} version'
changed_when: False changed_when: False
register: rvm_current_version register: rvm_current_version
when: rvm_binary.stat.exists when: rvm_binary.stat.exists
@@ -35,16 +35,15 @@
- name: Install rvm stable - name: Install rvm stable
command: > command: >
{{ rvm1_temp_download_path }}/rvm-installer.sh {{ rvm1_temp_download_path }}/rvm-installer.sh stable
--path {{ rvm1_install_path }} --path {{ rvm1_install_path }} {{ rvm1_install_flags }}
--auto-dotfiles stable
when: not rvm_binary.stat.exists when: not rvm_binary.stat.exists
- name: Update rvm - name: Update rvm
shell: '{{ rvm1 }} get stable && {{ rvm1 }} reload' shell: '{{ rvm1_rvm }} get stable && {{ rvm1_rvm }} reload'
when: rvm_binary.stat.exists and 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] rvm_stable_version_number.content | default(rvm1_rvm_stable_version_number) | replace('\n', '') > rvm_current_version.stdout.split()[1]
- name: Configure rvm - name: Configure rvm
command: '{{ rvm1 }} autolibs 3' command: '{{ rvm1_rvm }} autolibs 3'
when: not rvm_binary.stat.exists 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_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_rvm: '{{ rvm1_install_path }}/bin/rvm'
rvm1_ruby: '{{ rvm1_default_wrappers }}/ruby'
rvm1_gem: '{{ rvm1_default_wrappers }}/gem' rvm1_symlink_binaries:
rvm1_bundle: '{{ rvm1_default_wrappers }}/bundle' - 'bundle'
rvm1_rake: '{{ rvm1_bundle }} exec rake' - 'bundler'
- 'erb'
- 'executable-hooks-uninstaller'
- 'gem'
- 'irb'
- 'rake'
- 'rdoc'
- 'ri'
- 'ruby'
- 'testrb'
rvm1_symlink_to: '/usr/local/bin'