try this:

   - name: Verify ruby version is 1.9
     shell:  /opt/vagrant_ruby/bin/ruby --version |awk '{print $2}'
     register: status

   - fail: "This is bad version"
     when: status.stdout|version_compare("1.9", "eq")


`echo` is not needed as `ruby --version` already prints to screen, but
you really only want the version number which is what awk is doing
i use version_compare filter as it will match 1.9.x minor versions
also, if you don't want this add a ,strict=true to the filter to make
sure it is purely 1.9.
-- 
Brian Coca

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAJ5XC8kKUDp5vz-pjte2ndQE9HiCFm51MiAJzLoNyHdH-BKpCA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to