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. 

         

-- 
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 [email protected].
To post to this group, send email to [email protected].
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.

Reply via email to