Fix the fact description and add a test

This commit is contained in:
Nick Janetakis
2014-07-01 20:28:56 -04:00
parent d1ffc74d78
commit e885a2f1ab
4 changed files with 22 additions and 17 deletions

View File

@@ -57,30 +57,32 @@ You will likely want to use various ruby related commands in other roles. This r
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. 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` - `default_ruby_version`
- The default ruby version that is selected - The default ruby version that is selected
- `rvm1` - `rvm`
- The path to the rvm binary - The path to the rvm binary
- `rvm1_default_wrappers`: - `default_wrappers`:
- The path containing all of the wrapped ruby related binaries - The path containing all of the wrapped ruby related binaries
- `rvm1_ruby` - `ruby`
- The path to the ruby binary - The path to the ruby binary
- `rvm1_gem` - `gem`
- The path to the gem binary - The path to the gem binary
- `rvm1_bundle` - `bundle`
- The path to the bundle binary - The path to the bundle binary
- `rvm1_rake` - `rake`
- The path to the rake binary with bundle exec already applied - The path to the rake binary with bundle exec already applied
### Example ### Example
If you wanted to run a database migration in rails you would use `{{ rvm1_rake }} db:migrate`. You can access them in any play or role by prepending `ansible_local` to the value.
If you wanted to run a database migration in rails you would use `{{ ansible_local.rvm1.rake }} db:migrate`.
## Upgrading and removing old versions of ruby ## Upgrading and removing old versions of ruby

View File

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

View File

@@ -13,4 +13,7 @@
rvm1_install_path: '/home/travis/.rvm' rvm1_install_path: '/home/travis/.rvm'
roles: roles:
- ansible-ruby - ansible-ruby
post_tasks:
- debug: var=ansible_local.rvm1

View File

@@ -2,10 +2,10 @@
rvm1_default_wrappers: '{{ rvm1_install_path }}/wrappers/default' rvm1_default_wrappers: '{{ rvm1_install_path }}/wrappers/default'
rvm1_bundle: '{{ rvm1_default_wrappers }}/bundle' rvm1_bundle: '{{ rvm1_default_wrappers }}/bundle'
rvm1_facts: | rvm1_facts: |
rvm1_default_ruby_version='{{ rvm1_rubies | last if rvm1_rubies and rvm1_rubies is iterable else "" }}' default_ruby_version='{{ rvm1_rubies | last if rvm1_rubies and rvm1_rubies is iterable else "" }}'
rvm1='{{ rvm1_install_path }}/bin/rvm' rvm='{{ rvm1_install_path }}/bin/rvm'
rvm1_default_wrappers= '{{ rvm1_default_wrappers }}' default_wrappers= '{{ rvm1_default_wrappers }}'
rvm1_ruby='{{ rvm1_default_wrappers }}/ruby' ruby='{{ rvm1_default_wrappers }}/ruby'
rvm1_gem='{{ rvm1_default_wrappers }}/gem' gem='{{ rvm1_default_wrappers }}/gem'
rvm1_bundle='{{ rvm1_bundle }}' bundle='{{ rvm1_bundle }}'
rvm1_rake='{{ rvm1_bundle }} exec {{ rvm1_default_wrappers }}/rake' rake='{{ rvm1_bundle }} exec {{ rvm1_default_wrappers }}/rake'