Yeha, at first I was unsure if it was maybe me. But I did a lot of testing, 
I was about to create a bug report. Thanks for the confirmation Jonathan! :)


Le lundi 20 août 2018 15:13:09 UTC-4, Jonathan Lozada De La Matta a écrit :
>
> I think this is something you should file an issue to change if the other 
> modules accept names like that or it may be this module only accepts names 
> that way. I took a quick look at the issues and did not see anything 
> reported.
>
> On Mon, Aug 20, 2018 at 2:52 PM Eric Rousse <ericr...@gmail.com 
> <javascript:>> wrote:
>
>> Hello,
>>
>> I have a case here were I need to create VMs with a name based on a 
>> sequence and that sequence will generate numbers from 01 to 05 for example.
>> When I use the same sequence with azure_rm_networkinterface and 
>> azure_rm_securitygroup, is works fine and uses the same value for the name.
>>
>> Once I get to that part, the vmName gets all his 0 replaced by 8=*, so 
>> yeah, eight asterisk. I've also hardcode the VM part with a static value, 
>> with vmtestelab111, so then the error message about the vmName goes away. 
>> But then again I get an error about the sku, which contains 0. So is it 
>> really an issue with the module ? Or I'm doing something wrong ? At the 
>> bottom the original error message.
>>
>> - name: "get {{vmadminuser}} password"
>> command: >
>> az keyvault secret show --vault-name "{{ keyvault.name }}" --name "{{ 
>> vmadminuser }}" --query "{token: value}"
>> no_log: true
>> register: pass
>> - debug:
>> msg: "nsg{{vmName}}"
>> - name: Create security group
>> azure_rm_securitygroup:
>> resource_group: "{{ rg_name }}"
>> name: "nsg{{ vmName }}"
>> rules:
>> - name: "rdp"
>> protocol: Tcp
>> destination_port_range: 3389
>> source_address_prefix: "{{srcAddressPrefix}}"
>> access: Allow
>> priority: 100
>> direction: Inbound
>> - name: "winrm"
>> protocol: Tcp
>> destination_port_range: 5589
>> source_address_prefix: "{{srcAddressPrefix}}"
>> access: Allow
>> priority: 101
>> direction: Inbound
>> - debug:
>> msg: "nic{{vmName}}"
>> - name: Create NIC
>> azure_rm_networkinterface:
>> resource_group: "{{ rg_name }}"
>> name: "nic{{ vmName }}"
>> virtual_network: "{{ env[envName].vnet.ressourceid }}"
>> subnet: "{{ env[envName].subnet.name }}"
>> public_ip_name: None
>> ip_configurations:
>> - name: ipconfig1
>> primary: True
>> security_group: "nsg{{ vmName }}"
>> os_type: "{{ srvtype[os].os }}"
>> - debug:
>> msg: "{{vmName}}"
>> - name: Create VM
>> azure_rm_virtualmachine:
>> resource_group: "{{ rg_name }}"
>> name: "vmtestelab111"
>> admin_username: "{{ vmadminuser }}"
>> admin_password: "{{ pass }}"
>> image:
>> offer: "{{ srvtype[os].offer }}"
>> publisher: "{{ srvtype[os].publisher }}"
>> sku: "{{ srvtype[os].sku }}"
>> version: "{{ srvtype[os].version }}"
>> vm_size: Standard_D2s_v3
>> managed_disk_type: Standard_LRS
>> network_interfaces: "nic{{ vmName }}"
>> os_type: "{{ srvtype[os].os}}"
>> tags: 
>> niveau_service: "{{ niveau_service }}"
>> changed_when: false
>>
>>
>> {
>>     "_ansible_parsed": true,
>>     "invocation": {
>>         "module_args": {
>>             "virtual_network_resource_group": null,
>>             "resource_group": "rgtestelab********1",
>>             "public_ip_allocation_method": "Static",
>>             "image": {
>>                 "sku": "2********16-Datacenter",
>>                 "publisher": "MicrosoftWindowsServer",
>>                 "version": "2********16.127.2********18********613",
>>                 "offer": "WindowsServer"
>>             },
>>             "secret": null,
>>             "managed_disk_type": "Standard_LRS",
>>             "ssh_public_keys": null,
>>             "storage_container_name": "vhds",
>>             "allocated": true,
>>             "ssh_password_enabled": true,
>>             "storage_blob_name": null,
>>             "remove_on_absent": [
>>                 "all"
>>             ],
>>             "availability_set": null,
>>             "append_tags": true,
>>             "cloud_environment": null,
>>             "cert_validation_mode": null,
>>             "short_hostname": null,
>>             "virtual_network_name": null,
>>             "state": "present",
>>             "subnet_name": null,
>>             "admin_password": "********'stderr_lines': [], 'changed': 
>> True, 'end': '2********18-********8-2******** 
>> 18:****************:21.********8155********', 'stdout': 
>> '********\\n********\\n********', 'cmd': ['********', '********', 
>> '********', '********', '********', 'kvlabapp********1', '********', 
>> '********', '********', '********'], 'rc': ********, 'failed': False, 
>> 'stderr': '', 'delta': '********', 'stdout_lines': ['********', '********', 
>> '********'], 'start': '********'********",
>>             "network_interface_names": [
>>                 "nicvmtestelab********1********2"
>>             ],
>>             "subscription_id": null,
>>             "location": null,
>>             "profile": null,
>>             "tags": {
>>                 "niveau_service": "9a5"
>>             },
>>             "started": true,
>>             "open_ports": null,
>>             "restarted": false,
>>             "plan": null,
>>             "client_id": null,
>>             "auth_source": null,
>>             "vm_size": "Standard_D2s_v3",
>>             "password": null,
>>             "tenant": null,
>>             "name": "vmtestelab********1********2",
>>             "ad_user": null,
>>             "network_interfaces": "nicvmtestelab********1********2",
>>             "admin_username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
>>             "custom_data": null,
>>             "api_profile": "latest",
>>             "os_type": "Windows",
>>             "storage_account_name": null,
>>             "data_disks": null,
>>             "os_disk_caching": "ReadOnly"
>>         }
>>     },
>>     "changed": false,
>>     "_ansible_no_log": false,
>>     "msg": "Error creating or updating virtual machine 
>> vmtestelab********1********2 - Azure Error: InvalidParameter\nMessage: The 
>> supplied password must be between 8-123 characters long and must satisfy at 
>> least 3 of password complexity requirements from the following: \r\n1) 
>> Contains an uppercase character\r\n2) Contains a lowercase character\r\n3) 
>> Contains a numeric digit\r\n4) Contains a special character\r\n5) Control 
>> characters are not allowed\nTarget: adminPassword"
>> }
>>
>> -- 
>> 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-proje...@googlegroups.com <javascript:>.
>> To post to this group, send email to ansible...@googlegroups.com 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/d1d48d93-3c25-43a2-a857-22d9ce8bf98a%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/d1d48d93-3c25-43a2-a857-22d9ce8bf98a%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
>
> Jonathan lozada de la matta
>
> AUTOMATION CONSULTANT - AUTOMATION PRACTICE
>
> Red Hat Consulting Services <https://www.redhat.com/>
>
> jloz...@redhat.com <javascript:>    
>
>
>  
>
>

-- 
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/f7b1305f-34b9-4cb6-8930-60a863f54ffa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to