Hrm, kinda looks like a templating bug (or a bad template value)- pretty sure it's not a module bug since it's working with the discrete dict.
Can you run that both ways in check_mode with -vv and look at the tags element in the invocation value from the result to see if it looks the same in both cases? If it works with the discrete dict and fails with the templated one, I'm guessing that the templated arg isn't getting rendered in the right shape to the module. -Matt On Friday, April 7, 2017 at 6:22:18 AM UTC-7, [email protected] wrote: > > Hi, > > Not sure yet if what I have here is a bug or not, so thought I'd ask > first. I'm seeing a strange failure out of azure_rm_virtualmachine in the > latest ansible devel. The working playbook looks as follows: > - name: Create VM and attach NIC > azure_rm_virtualmachine: > resource_group: '{{ rg }}' > name: '{{service_name}}-vm-{{item}}' > network_interface_names: '{{service_name}}-vm-{{item}}-nic' > storage_account: '{{ env_name }}' > vm_size: Standard_DS1_v2 > admin_username: hoylu > ssh_password_enabled: False > ssh_public_keys: '{{ssh_keys}}' > image: > offer: UbuntuServer > publisher: Canonical > sku: '16.04-LTS' > version: latest > tags: > env: '{{env}}' > service: '{{service}}' > with_sequence: > start=1 > end='{{count}}' > stride=1 > format=%02d > > This code runs. When I then change the tags: section of the playbook task > to a dictionary that looks like the following: > tags: '{{ { "env": env, service: env } }}' > I get an error that looks like this: > "module_stderr": "Traceback (most recent call last):\n File > \"/var/folders/06/zm5r71tj60b4_19wlz7h822m0000gn/T/ansible_GI_w3r/ansible_module_azure_rm_virtualmachine.py\", > > line 1311, in <module>\n main()\n File > \"/var/folders/06/zm5r71tj60b4_19wlz7h822m0000gn/T/ansible_GI_w3r/ansible_module_azure_rm_virtualmachine.py\", > > line 1308, in main\n AzureRMVirtualMachine()\n File > \"/var/folders/06/zm5r71tj60b4_19wlz7h822m0000gn/T/ansible_GI_w3r/ansible_module_azure_rm_virtualmachine.py\", > > line 554, in __init__\n supports_check_mode=True)\n File > \"/var/folders/06/zm5r71tj60b4_19wlz7h822m0000gn/T/ansible_GI_w3r/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py\", > > line 197, in __init__\n File > \"/var/folders/06/zm5r71tj60b4_19wlz7h822m0000gn/T/ansible_GI_w3r/ansible_module_azure_rm_virtualmachine.py\", > > line 797, in exec_module\n > vm_id=vm_dict['properties']['vmId'],\nKeyError: 'vmId'\n", > > This error only happens with the azure_rm_virtualmachine module. The > azure_rm_publicipaddress and azure_rm_networkinterface modules are both > fine with that change. Is there some vagary of azure I'm not aware of > that's biting me here, or does this look like a bug to folks? > > Thanks, > > Marcin > -- 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/d566b887-f5b6-4cb9-b673-2a2bf8c60627%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
