Change facts back to variables

This commit is contained in:
Nick Janetakis
2014-07-02 08:39:27 -04:00
parent 7555d13122
commit 1947717539
7 changed files with 27 additions and 44 deletions

View File

@@ -1,6 +0,0 @@
---
- name: ensure /etc/ansible/facts.d is created
file: path='/etc/ansible/facts.d' state='directory'
- name: ensure facts are persisted in /etc/ansible/facts.d/rvm1.fact
template: src='etc/ansible/facts.d/rvm1.fact.j2' dest='/etc/ansible/facts.d/rvm1.fact'

View File

@@ -1,4 +1,3 @@
---
- include: 'facts.yml'
- include: 'rvm.yml'
- include: 'rubies.yml'

View File

@@ -1,6 +1,6 @@
---
- name: detect if rubies are installed
command: '{{ ansible_local.rvm1.rvm }} {{ item }} do true'
command: '{{ rvm1 }} {{ item }} do true'
changed_when: false
failed_when: false
register: detect_rubies
@@ -8,30 +8,30 @@
when: rvm1_rubies
- name: ensure rubies are installed
command: '{{ ansible_local.rvm1.rvm }} install {{ item.item }}'
command: '{{ rvm1 }} install {{ item.item }}'
when: rvm1_rubies and item.rc != 0
with_items: detect_rubies.results
- name: detect default ruby version
command: '{{ ansible_local.rvm1.rvm }} alias list default'
command: '{{ rvm1 }} alias list default'
changed_when: false
register: detect_default_ruby_version
- name: ensure default ruby is selected
command: '{{ ansible_local.rvm1.rvm }} alias create default {{ ansible_local.rvm1.default_ruby_version }}'
when: detect_default_ruby_version.stdout == '' or ansible_local.rvm1.default_ruby_version not in detect_default_ruby_version.stdout
command: '{{ rvm1 }} 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: ensure rvm install path is writable by the set owner:group
file: path='{{ rvm1_install_path }}' state=directory recurse=yes owner='{{ rvm1_user }}' group='{{ rvm1_group }}'
- name: detect if ruby version can be deleted
command: '{{ ansible_local.rvm1.rvm }} {{ rvm1_delete_ruby }} do true'
command: '{{ rvm1 }} {{ rvm1_delete_ruby }} do true'
changed_when: false
failed_when: false
register: detect_delete_ruby
when: rvm1_delete_ruby
- name: ensure ruby version is deleted
command: '{{ ansible_local.rvm1.rvm }} remove {{ rvm1_delete_ruby }}'
command: '{{ rvm1 }} remove {{ rvm1_delete_ruby }}'
changed_when: false
when: rvm1_delete_ruby and detect_delete_ruby.rc == 0

View File

@@ -1,6 +1,6 @@
---
- name: detect rvm binary
stat: path='{{ ansible_local.rvm1.rvm }}'
stat: path='{{ rvm1 }}'
register: rvm_binary
- name: detect rvm installer
@@ -8,7 +8,7 @@
register: rvm_installer
- name: detect current rvm version
command: '{{ ansible_local.rvm1.rvm }} version'
command: '{{ rvm1 }} version'
changed_when: false
register: rvm_current_version
when: rvm_binary.stat.exists
@@ -39,9 +39,9 @@
when: not rvm_binary.stat.exists
- name: ensure rvm is upgraded
shell: '{{ ansible_local.rvm1.rvm }} get stable && {{ ansible_local.rvm1.rvm }} reload'
shell: '{{ rvm1 }} get stable && {{ rvm1 }} 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: ensure rvm installs ruby dependencies
command: '{{ ansible_local.rvm1.rvm }} autolibs 3'
command: '{{ rvm1 }} autolibs 3'
when: not rvm_binary.stat.exists