From e885a2f1ab0fe30211ef47776f8538aca8f03a62 Mon Sep 17 00:00:00 2001 From: Nick Janetakis Date: Tue, 1 Jul 2014 20:28:56 -0400 Subject: [PATCH] Fix the fact description and add a test --- README.md | 18 ++++++++++-------- tasks/main.yml | 2 +- tests/test.yml | 5 ++++- vars/main.yml | 14 +++++++------- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index f8c1aa2..16a11b7 100644 --- a/README.md +++ b/README.md @@ -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. -- `rvm1_default_ruby_version` +- `default_ruby_version` - The default ruby version that is selected -- `rvm1` +- `rvm` - The path to the rvm binary -- `rvm1_default_wrappers`: +- `default_wrappers`: - The path containing all of the wrapped ruby related binaries -- `rvm1_ruby` +- `ruby` - The path to the ruby binary -- `rvm1_gem` +- `gem` - The path to the gem binary -- `rvm1_bundle` +- `bundle` - The path to the bundle binary -- `rvm1_rake` +- `rake` - The path to the rake binary with bundle exec already applied ### 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 diff --git a/tasks/main.yml b/tasks/main.yml index 66fb123..d03f7d3 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,4 @@ --- -- include: 'facts.yml +- include: 'facts.yml' - include: 'rvm.yml' - include: 'rubies.yml' \ No newline at end of file diff --git a/tests/test.yml b/tests/test.yml index d159f5f..24d0b2f 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -13,4 +13,7 @@ rvm1_install_path: '/home/travis/.rvm' roles: - - ansible-ruby \ No newline at end of file + - ansible-ruby + + post_tasks: + - debug: var=ansible_local.rvm1 \ No newline at end of file diff --git a/vars/main.yml b/vars/main.yml index c72b240..1b60d91 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -2,10 +2,10 @@ rvm1_default_wrappers: '{{ rvm1_install_path }}/wrappers/default' rvm1_bundle: '{{ rvm1_default_wrappers }}/bundle' 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' \ No newline at end of file + default_ruby_version='{{ rvm1_rubies | last if rvm1_rubies and rvm1_rubies is iterable else "" }}' + rvm='{{ rvm1_install_path }}/bin/rvm' + default_wrappers= '{{ rvm1_default_wrappers }}' + ruby='{{ rvm1_default_wrappers }}/ruby' + gem='{{ rvm1_default_wrappers }}/gem' + bundle='{{ rvm1_bundle }}' + rake='{{ rvm1_bundle }} exec {{ rvm1_default_wrappers }}/rake' \ No newline at end of file