diff --git a/README.md b/README.md index 0e27fa5..7c2b18d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/defaults/main.yml b/defaults/main.yml index ec4b54f..c5498e1 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/tasks/main.yml b/tasks/main.yml index 1e34738..4319535 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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' diff --git a/tasks/rvm.yml b/tasks/rvm.yml index 863c779..566ef77 100644 --- a/tasks/rvm.yml +++ b/tasks/rvm.yml @@ -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'