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:
14
README.md
14
README.md
@@ -40,16 +40,14 @@ rvm1_install_path: '/usr/local/lib/rvm'
|
|||||||
# make sure you ADD the --user-install flag below
|
# make sure you ADD the --user-install flag below
|
||||||
rvm1_install_flags: '--auto-dotfiles'
|
rvm1_install_flags: '--auto-dotfiles'
|
||||||
|
|
||||||
# Should rvm always be upgraded?
|
# URL for the latest installer script
|
||||||
rvm1_rvm_force_upgrade_installer: False
|
|
||||||
|
|
||||||
# URLs for the latest installer and version
|
|
||||||
rvm1_rvm_latest_installer: 'https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer'
|
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
|
# rvm version to use
|
||||||
# This is only used to download the httplib library so Ansible's URI module works
|
rvm1_rvm_version: 'stable'
|
||||||
apt_cache_valid_time: 86400
|
|
||||||
|
# Check and update rvm, disabling this will force rvm to never update
|
||||||
|
rvm1_rvm_check_for_updates: True
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example playbook
|
## Example playbook
|
||||||
|
|||||||
@@ -15,13 +15,11 @@ rvm1_install_path: '/usr/local/lib/rvm'
|
|||||||
# make sure you ADD the --user-install flag below
|
# make sure you ADD the --user-install flag below
|
||||||
rvm1_install_flags: '--auto-dotfiles'
|
rvm1_install_flags: '--auto-dotfiles'
|
||||||
|
|
||||||
# Should rvm always be upgraded?
|
# URL for the latest installer script
|
||||||
rvm1_rvm_force_upgrade_installer: False
|
|
||||||
|
|
||||||
# URLs for the latest installer and version
|
|
||||||
rvm1_rvm_latest_installer: 'https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer'
|
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
|
# rvm version to use
|
||||||
# This is only used to download the httplib library so Ansible's URI module works
|
rvm1_rvm_version: 'stable'
|
||||||
apt_cache_valid_time: 86400
|
|
||||||
|
# Check and update rvm, disabling this will force rvm to never update
|
||||||
|
rvm1_rvm_check_for_updates: True
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- include: 'debian.yml'
|
|
||||||
when: ansible_os_family == 'Debian'
|
|
||||||
|
|
||||||
- include: 'redhat.yml'
|
|
||||||
when: ansible_os_family == 'RedHat'
|
|
||||||
|
|
||||||
- include: 'rvm.yml'
|
- include: 'rvm.yml'
|
||||||
- include: 'rubies.yml'
|
- include: 'rubies.yml'
|
||||||
|
|||||||
@@ -14,35 +14,28 @@
|
|||||||
register: rvm_current_version
|
register: rvm_current_version
|
||||||
when: rvm_binary.stat.exists
|
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
|
- name: Install rvm installer
|
||||||
get_url:
|
get_url:
|
||||||
url: '{{ rvm1_rvm_latest_installer }}'
|
url: '{{ rvm1_rvm_latest_installer }}'
|
||||||
dest: '{{ rvm1_temp_download_path }}/rvm-installer.sh'
|
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
|
- name: Configure rvm installer
|
||||||
file:
|
file:
|
||||||
path: '{{ rvm1_temp_download_path }}/rvm-installer.sh'
|
path: '{{ rvm1_temp_download_path }}/rvm-installer.sh'
|
||||||
mode: 0755
|
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: >
|
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 }}
|
--path {{ rvm1_install_path }} {{ rvm1_install_flags }}
|
||||||
when: not rvm_binary.stat.exists
|
when: not rvm_binary.stat.exists
|
||||||
|
|
||||||
- name: Update rvm
|
- name: Update rvm
|
||||||
shell: '{{ rvm1_rvm }} get stable && {{ rvm1_rvm }} reload'
|
shell: '{{ rvm1_rvm }} get {{ rvm1_rvm_version }} && {{ rvm1_rvm }} reload'
|
||||||
when: rvm_binary.stat.exists and
|
changed_when: False
|
||||||
rvm_stable_version_number.content | default(rvm1_rvm_stable_version_number) | replace('\n', '') > rvm_current_version.stdout.split()[1]
|
when: rvm_binary.stat.exists and rvm1_rvm_check_for_updates
|
||||||
|
|
||||||
- name: Configure rvm
|
- name: Configure rvm
|
||||||
command: '{{ rvm1_rvm }} autolibs 3'
|
command: '{{ rvm1_rvm }} autolibs 3'
|
||||||
|
|||||||
Reference in New Issue
Block a user