On 15 Mar 2013 11:56, "Michael DeHaan" <mic...@ansibleworks.com> wrote:
>
> >
> > Is there a better way to do the following ?
> >
> > ---
> > ...
> > tasks:
> > - name: derive latest 2.5 release
> > local_action: shell ls /var/releases/v2.5-* | tail -1
> > register: release
> > when_unset: $version
> >
> > - name: register version into release
> > local_action: command echo $version
> > register: release
> > when_set: $version
> >
> >
> > I would prefer the second task to be something like this (rather than having
> > to store the result of echoing the property!)
> >
> > - name: store release.stdout into version
> > local_action: variable name=version value=${release.stdout}
>
> I'm not really against some kind of action plugin called 'setvar' that
> allows you to pass in python statements, but this seems like a
> question about
> whether hostvars has higher priority than extravars, and we've
> explicitly added extra vars at maximum priority so they can override
> defaults.
I think my question is more about how I can make the results of a registered variable be equivalent to other variables.
I'm happy with the precedence order, I just want to be able to derive a variable, with the same name, if it is not set.
> http://ansible.cc/docs/playbooks2.html#understanding-variable-precedence
>
> What it seems to me is that instead of doing it the way you are doing
> it, you could set the default in group_vars/all, and then let the
> computed variable
> override it there.
My problem is that the variables are being passed in by external deployment tool (deploy release x.y.z or just deploy latest) and so are passed in as extra vars.
--
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/ac43d9a7-b385-4312-a2ea-790e654a39bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/wqiclLkqmGU/unsubscribe.
To unsubscribe from this group and all its topics, 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/CAEVJ8QODgHkQJPNPMVCii73ChsF8RGaHaHajkiZDwdEC4vPN6w%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/532CD0B2.3070203%40spryhive.com.
shell: 'getent passwd <user> |cut -f 6 -d ":" 'register: userhome
--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/wqiclLkqmGU/unsubscribe.
To unsubscribe from this group and all its topics, 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/CADn%2BHszUR%3DzcKWDjiiS0OXDMLuz_6-hg1oHOw93s502uDv8A0w%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6B08BD98-9E7D-468C-BD6B-B1EAF0C5A0A4%40thames.id.au.