Hi Peter,

IMHO it is because your variables are defined for the host “local” within your 
1st play, the hosts group “launched” cannot know about variables defined for 
another group

Hope this help.

Fred

On Jan 8, 2015, at 08:05 , Peter Mooshammer  wrote:

> Hi there, 
> 
> I am fairly new with ansible and I am having some with variables :-).
> 
> Here is my 1st problem, I have a playbook I do have a variable:
> 
> - name: Create instance(s)
>   hosts: local
>   gather_facts: no
>   connection: local
>   tags: provisioning
>   vars:
>     ....
>     groupname: launched
>     port: 8080
> 
> 
> Later I use it in the add_host line:
> 
>  
>  - name: Add host to groupname
>     add_host: hostname={{ item.public_ip }} 
> ansible_ssh_private_key_file=PATH_TO_KEYFILE groupname={{ groupname }}
>     with_items: gce.instance_data
> 
> 
> 
> and then I use it again at:
> 
> -
>  name: Manage new instances
>   hosts: "{{ groupname }}"
>   connection: ssh
>   sudo: True
>   roles:
>   - { role: webserver, port: "{{ port }}" }
> 
> 
> 
> but I doesn't work - replacing it with:
>  hosts: launched
> 
> Second problem - maybe related I try to overwrite a variable in a role I 
> include:
> 
> roles:
>   - { role: webserver, port: "{{ port }}" }
> 
> this also doesn't work. Any hints?
> 
> thanks
> 
> Peter
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> 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/28fa7149-29e5-46f7-ac90-fb79e67ac422%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/A89BDC4B-0DF3-4179-AB5D-C40827B45006%40never-mind.ch.
For more options, visit https://groups.google.com/d/optout.

Reply via email to