Thanks Jon, I'll distill it a bit and see what I come up with.

On Thursday, June 16, 2016 at 9:45:43 AM UTC+2, J Hawkesworth wrote:
>
> That is very unexpected.
>
> I pass vars to the same role a lot, although in my case I am usually doing 
> it within the same play (as opposed to within a different play inside the 
> same playbook), and I almost always pass the vars in as -e (extra vars), 
> which from memory have highest precedence.
>
> Looking at your playbook I just wonder if there's something odd going on 
> to do with the type of the vars.  From memory yaml treats unquoted yes and 
> no as boolean true/false values, so it could be that the booleans aren't 
> getting passed as you'd expect but the strings are.
>
> Maybe it would be worth just experimenting and changing your role so it 
> expects a string for create_availability_set, quoting your "yes" and seeing 
> if that makes a difference.
>
> Feels like a bug to me though if that is the case.
>
> Jon
>
> On Wednesday, June 15, 2016 at 8:04:55 PM UTC+1, Trond Hindenes wrote:
>>
>> From what I can see, once a previously undefined variable has been set by 
>> a role, the calling playbook is unable to override it on subsequent calls.
>>
>> On Wednesday, June 15, 2016 at 8:29:17 PM UTC+2, Trond Hindenes wrote:
>>>
>>> Hi, 
>>> I have this weird situation where a role doesn't pick up configured 
>>> variables, hopefully someone can help me out. 
>>> This is parts of my playbook:
>>> -   name: Deploy Elasticsearch VMs
>>>     hosts: localhost
>>>     tags:
>>>         - deploy
>>>     vars:
>>>         os_type: Windows
>>>         public_ip: yes
>>>         use_max_datadisks: True
>>>         create_network_security_group: nsg_eslogging
>>>         create_availability_set: yes
>>>         add_to_adhoc_group: elasticsearch
>>>
>>>     roles:
>>>         - { role: customer_deploy_azurevm, vm_name: customer-prod-es1}
>>>         - { role: customer_deploy_azurevm, vm_name: customer-prod-es2}
>>>
>>> -   name: Deploy logstash VMs
>>>     hosts: localhost
>>>     tags:
>>>         - deploy
>>>     vars:
>>>         os_type: Windows
>>>         public_ip: yes
>>>         max_data_disk_count: 2
>>>         create_network_security_group: nsg_logstash
>>>         create_availability_set: yes
>>>         availability_set_name: as-customer-prod-logstash
>>>         add_to_adhoc_group: logstash
>>>     roles:
>>>         - { role: customer_deploy_azurevm, vm_name: customer-prod-ls1}
>>>         - { role: customer_deploy_azurevm, vm_name: customer-prod-ls2}
>>>
>>> The weird thing that happens is that the second play's vms don't get the 
>>> correct availability set (availability_set_name), but they DO get the 
>>> correct nsg (create_network_security_group). The customer_deploy_azurevm 
>>> roles works so that if "create_availability_set" is true and 
>>> "availability_set_name" is not set, then an autogenerated availability set 
>>> name will be used. This variable seems to "linger" so that the following to 
>>> vms get the previous auto-generated availability set name (I can see this 
>>> if I dump all vars before I do anything else in the role)
>>>
>>> This seems completely weird to me. Am I doing something wrong, or is 
>>> this a bug?
>>>
>>>

-- 
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/bd525900-741a-48fc-b514-26df134a0b6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to