Remove the python-httplib2 dependency

Rather than check the remote VERSION with the 'uri' Ansible module
I decided to just always run rvm update unless you specifically disable
that in the default options.

The benefits of this change is that the role no longer depends on any
packages and CentOS 7 does not have python-httplib2 anyways.

The cons of this change is that the update takes an additional 2-3
seconds to run when it was skipped previously unless needed. However, with the
elimination of quite a few tasks and logic the overall run speed of the
role is faster than before.
This commit is contained in:
Nick Janetakis
2014-10-16 10:22:33 -04:00
parent 98a4eb88b2
commit a1faa54af6
4 changed files with 19 additions and 36 deletions

View File

@@ -40,16 +40,14 @@ rvm1_install_path: '/usr/local/lib/rvm'
# make sure you ADD the --user-install flag below
rvm1_install_flags: '--auto-dotfiles'
# Should rvm always be upgraded?
rvm1_rvm_force_upgrade_installer: False
# URLs for the latest installer and version
# URL for the latest installer script
rvm1_rvm_latest_installer: 'https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer'
rvm1_rvm_stable_version_number: 'https://raw.githubusercontent.com/wayneeseguin/rvm/master/VERSION'
# Time in seconds before re-running apt-get update
# This is only used to download the httplib library so Ansible's URI module works
apt_cache_valid_time: 86400
# rvm version to use
rvm1_rvm_version: 'stable'
# Check and update rvm, disabling this will force rvm to never update
rvm1_rvm_check_for_updates: True
```
## Example playbook

View File

@@ -15,13 +15,11 @@ rvm1_install_path: '/usr/local/lib/rvm'
# make sure you ADD the --user-install flag below
rvm1_install_flags: '--auto-dotfiles'
# Should rvm always be upgraded?
rvm1_rvm_force_upgrade_installer: False
# URLs for the latest installer and version
# URL for the latest installer script
rvm1_rvm_latest_installer: 'https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer'
rvm1_rvm_stable_version_number: 'https://raw.githubusercontent.com/wayneeseguin/rvm/master/VERSION'
# Time in seconds before re-running apt-get update
# This is only used to download the httplib library so Ansible's URI module works
apt_cache_valid_time: 86400
# rvm version to use
rvm1_rvm_version: 'stable'
# Check and update rvm, disabling this will force rvm to never update
rvm1_rvm_check_for_updates: True

View File

@@ -1,10 +1,4 @@
---
- include: 'debian.yml'
when: ansible_os_family == 'Debian'
- include: 'redhat.yml'
when: ansible_os_family == 'RedHat'
- include: 'rvm.yml'
- include: 'rubies.yml'

View File

@@ -14,35 +14,28 @@
register: rvm_current_version
when: rvm_binary.stat.exists
- name: Detect stable rvm version
uri:
url: '{{ rvm1_rvm_stable_version_number }}'
return_content: True
register: rvm_stable_version_number
when: '"://" in rvm1_rvm_stable_version_number'
- name: Install rvm installer
get_url:
url: '{{ rvm1_rvm_latest_installer }}'
dest: '{{ rvm1_temp_download_path }}/rvm-installer.sh'
when: not rvm_installer.stat.exists or rvm1_rvm_force_upgrade_installer
when: not rvm_installer.stat.exists
- name: Configure rvm installer
file:
path: '{{ rvm1_temp_download_path }}/rvm-installer.sh'
mode: 0755
when: not rvm_binary.stat.exists or rvm1_rvm_force_upgrade_installer
when: not rvm_binary.stat.exists
- name: Install rvm stable
- name: Install rvm
command: >
{{ rvm1_temp_download_path }}/rvm-installer.sh stable
{{ rvm1_temp_download_path }}/rvm-installer.sh {{ rvm1_rvm_version }}
--path {{ rvm1_install_path }} {{ rvm1_install_flags }}
when: not rvm_binary.stat.exists
- name: Update rvm
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]
shell: '{{ rvm1_rvm }} get {{ rvm1_rvm_version }} && {{ rvm1_rvm }} reload'
changed_when: False
when: rvm_binary.stat.exists and rvm1_rvm_check_for_updates
- name: Configure rvm
command: '{{ rvm1_rvm }} autolibs 3'