Discussion:
[ansible-project] Run ansible playbook in uninitialized env?
Valeriy Solovyov
2015-07-29 14:39:30 UTC
Permalink
Hello,

I use some script that executes a ansible playbook from upstart.
If I use lookup for variable playbook/task/defaults/main.yml:
user: "{{ lookup('env','USER') }}"
home: "{{ lookup('env','HOME') }}"

It will the empty variables. Because upstart doesn't provide root or etc
env.

My question is how to setup default value if lookup will return the empty
result?
--
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-project+***@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/89e31cca-7084-4f4d-b3f9-87040757aa31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Brian Coca
2015-07-29 14:49:55 UTC
Permalink
user: "{{ lookup('env','USER')|default('root') }}"

On Wed, Jul 29, 2015 at 10:39 AM, Valeriy Solovyov
Post by Valeriy Solovyov
Hello,
I use some script that executes a ansible playbook from upstart.
user: "{{ lookup('env','USER') }}"
home: "{{ lookup('env','HOME') }}"
It will the empty variables. Because upstart doesn't provide root or etc
env.
My question is how to setup default value if lookup will return the empty
result?
--
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
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/89e31cca-7084-4f4d-b3f9-87040757aa31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 ansible-project+***@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/CAJ5XC8kM1-65RtsBX8U_z6Me8m9KRmq7ZoJGoN6bbzzF-L%3D-HQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...