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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/45d54e65-2252-4138-96da-addacf7812f8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.