Groups
Groups
Sign in
Groups
Groups
Ansible Project
Conversations
About
Send feedback
Help
trying to pass variable to hosts
32 views
Skip to first unread message
madha...@gmail.com
unread,
May 7, 2017, 3:41:03 PM
5/7/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
I am trying to pass a variables to the hosts in a play
- name: include vars
hosts: localhost
connection: local
tasks:
- include_vars:
dir: '../group_vars'
depth: 1
- name: debug
hosts: localhost
connection: local
tasks:
- debug: msg="{{ kfkahost0 }}"
- name: Create topic
hosts: "{{ kfkahost0 }}"
tasks:
# - name: include vars
# - include_vars: dir="../group_vars" depth="1"
#dir: '../group_vars'
#depth: 1
- shell: ./app/bin/kafka/bin/kafka-topics.sh --zookeeper {{ zkhost0 }}:2181 --create --topic {{ topic }} --partitions {{ partition }} --replication-factor {{ rpfactor }}
42,3 Bot
in the debug step i see the hostname comes out in the msg fine
but in the next play it says kfkahost0 is undefined.
Dick Davies
unread,
May 7, 2017, 7:30:46 PM
5/7/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible list
Those variables are set on localhost , not kfkahost0.
Why don't you just put your kafka host in a group and use group_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/8c3b338e-f073-4fbe-b91d-46de1851d4c3%40googlegroups.com
.
> For more options, visit
https://groups.google.com/d/optout
.
Jon Franklin
unread,
May 31, 2017, 8:34:33 AM
5/31/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com, madha...@gmail.com
> --
> 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/8c3b338e-f073-4fbe-b91d-46de1851d4c3%40googlegroups.com
.
> For more options, visit
https://groups.google.com/d/optout
.
Use hostvars, like: {{ hostvars['localhost']['kfkahost0'] }}
Reply all
Reply to author
Forward
0 new messages