Persist the exposed variables as local facts
This commit is contained in:
@@ -51,9 +51,11 @@ rvm1_rvm_stable_version_number: 'https://raw.githubusercontent.com/wayneeseguin/
|
||||
rvm1_rvm_force_upgrade_installer: false
|
||||
```
|
||||
|
||||
## Exposed variables for use in other roles
|
||||
## Facts
|
||||
|
||||
You will likely want to use various ruby related commands in other roles. This role exposes a number of popular paths and variables for easy access.
|
||||
You will likely want to use various ruby related commands in other roles. This role exposes a number of popular paths and variables as persisted facts.
|
||||
|
||||
Since the values are saved to `/etc/ansible/facts.d/rvm1.fact` you do not need to run this role every time you invoke your play book to have access to the facts. They will be persisted between play book runs.
|
||||
|
||||
- `rvm1_default_ruby_version`
|
||||
- The default ruby version that is selected
|
||||
|
||||
6
tasks/facts.yml
Normal file
6
tasks/facts.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
- 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'
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
- include: 'facts.yml
|
||||
- include: 'rvm.yml'
|
||||
- include: 'rubies.yml'
|
||||
1
templates/etc/ansible/facts.d/rvm1.fact.j2
Normal file
1
templates/etc/ansible/facts.d/rvm1.fact.j2
Normal file
@@ -0,0 +1 @@
|
||||
{{ rvm1_facts }}
|
||||
@@ -1,8 +1,11 @@
|
||||
---
|
||||
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_ruby: '{{ rvm1_default_wrappers }}/ruby'
|
||||
rvm1_gem: '{{ rvm1_default_wrappers }}/gem'
|
||||
rvm1_bundle: '{{ rvm1_default_wrappers }}/bundle'
|
||||
rvm1_rake: '{{ rvm1_bundle }} exec {{ rvm1_default_wrappers }}/rake'
|
||||
rvm1_facts: |
|
||||
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_default_wrappers }}'
|
||||
rvm1_ruby='{{ rvm1_default_wrappers }}/ruby'
|
||||
rvm1_gem='{{ rvm1_default_wrappers }}/gem'
|
||||
rvm1_bundle='{{ rvm1_bundle }}'
|
||||
rvm1_rake='{{ rvm1_bundle }} exec {{ rvm1_default_wrappers }}/rake'
|
||||
Reference in New Issue
Block a user