Run ansible playbook in uninitialized env?

16 visualizzazioni
Passa al primo messaggio da leggere

Valeriy Solovyov

da leggere,
29 lug 2015, 10:39:3029/07/15
a Ansible Project
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?

Brian Coca

da leggere,
29 lug 2015, 10:49:5929/07/15
a Ansible Project
user: "{{ lookup('env','USER')|default('root') }}"
> --
> 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/89e31cca-7084-4f4d-b3f9-87040757aa31%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Brian Coca
Rispondi a tutti
Rispondi all'autore
Inoltra
0 nuovi messaggi