Extrapolate data from facts?

18 views
Skip to first unread message

John Oliver

unread,
Jul 18, 2014, 5:01:39 PM7/18/14
to ansible...@googlegroups.com
I would like to be able to test Macs for the major version of OS X, ie. Lion, Mountain Lion, Mavericks.  I see a fact called "ansible_distribution_version" which is equal to the whole software rev, like "10.9.4"  Can I have ansible perform some operation like cut or awk so I can wind up with "10.9" or "10.8"?

Michael DeHaan

unread,
Jul 18, 2014, 6:52:09 PM7/18/14
to ansible...@googlegroups.com
You may be interested in the regex replace filter, as shown in the docs here:

http://docs.ansible.com/playbooks_variables.html#id26

{{ 'foobar' | regex_replace('^f.*o(.*)$', '\\1') }}




On Fri, Jul 18, 2014 at 5:01 PM, John Oliver <jno...@gmail.com> wrote:
I would like to be able to test Macs for the major version of OS X, ie. Lion, Mountain Lion, Mavericks.  I see a fact called "ansible_distribution_version" which is equal to the whole software rev, like "10.9.4"  Can I have ansible perform some operation like cut or awk so I can wind up with "10.9" or "10.8"?

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8a24ffa7-9a5d-4b3e-8f07-81e8bf81134f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages