'register' and perhaps 'set_fact' are probably what you need - here's an
example:
$ cat set_fact.yml
---
- hosts: linux
tasks:
- name: call a command to get some output...
command: "echo somecomandoutput"
delegate_to: localhost
register: result
# debug statements very handy for seeing what's in your registered
variables.
- debug: var=result
# now use set_fact to put the var into a fact.
- name: set fact based on output of previous command
set_fact:
my_hg_root: "{{result.stdout_lines[0]}}"
# debug just to show the value is now in the fact
- debug: var=my_hg_root
On Saturday, December 20, 2014 5:07:44 PM UTC, Roy Smith wrote:
>
> I want to set a playbook variable to the root of my hg tree, i.e. capture
> the output of the "hg root" command run on my local host. How do I do that?
>
>
--
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/b8b8be2f-360b-4426-aaaa-575141f2daa5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.