Is there a way to use variables with ad-hoc commands

62 views
Skip to first unread message

Alainkr

unread,
Aug 28, 2014, 4:44:13 AM8/28/14
to ansible...@googlegroups.com
Hello,

I wanted to do that :

ansible -i inventories/production all -m shell  -a "echo urok  | nc  {{ ansible_eth1.ipv4.address }} 2181 "

But it it seams that vars are not supported within ad-hoc commands. Right ?

Thanks

Alain


Michael DeHaan

unread,
Aug 28, 2014, 7:57:22 AM8/28/14
to ansible...@googlegroups.com
Variables are, including inventory variables and "-e", but you cannot use fact gathering with /usr/bin/ansible, as they are a playbook only construct.







--
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/28590f88-e3b2-442b-9d5e-4958d8e20a9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alainkr

unread,
Aug 28, 2014, 8:27:41 AM8/28/14
to ansible...@googlegroups.com

Ok thanks

Tomasz Kontusz

unread,
Aug 28, 2014, 11:24:49 AM8/28/14
to ansible...@googlegroups.com


Michael DeHaan <mic...@ansible.com> napisał:
>Variables are, including inventory variables and "-e", but you cannot
>use
>fact gathering with /usr/bin/ansible, as they are a playbook only
>construct.
>
Will fact caching change that? Or is bin/ansible not aware of the cache?


>
>
>On Thu, Aug 28, 2014 at 4:44 AM, Alainkr <akrei...@gmail.com> wrote:
>
>> Hello,
>>
>> I wanted to do that :
>>
>> ansible -i inventories/production all -m shell -a "echo urok | nc
>{{
>> ansible_eth1.ipv4.address }} 2181 "
>>
>> But it it seams that vars are not supported within ad-hoc commands.
>Right ?
>>
>> Thanks
>>
>> Alain
>>
>>
>> --
>> 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/28590f88-e3b2-442b-9d5e-4958d8e20a9e%40googlegroups.com
>>
><https://groups.google.com/d/msgid/ansible-project/28590f88-e3b2-442b-9d5e-4958d8e20a9e%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>

--
Wysłane za pomocą K-9 Mail.

Michael DeHaan

unread,
Aug 28, 2014, 5:04:23 PM8/28/14
to ansible...@googlegroups.com
Should change that, yes!





Reply all
Reply to author
Forward
0 new messages