Thanks, Todd.  

According the docs, the name: param is for the virtual machine and 
hostname: under customization: is for setting the hostname.  I was able to 
register the stdout of the task, capturing it 
to a variable.   The substitutions are being made.  

      "instance": {
        "module_hw": true,
        "hw_name": "rheltest0816d",
        "hw_power_status": "poweredOn",

-and- 

          "customization": {
            "existing_vm": true,
            "dns_servers": [
              "redacted",
              "redacted"
            ],
            "domain": "<redacted>",
            "hostname": "rheltest0816d",

The hostname is not being updated on the vm though and that's causing a 
glitch downstream in the next job template in the workflow.  
I'm not sure if I should move the state: param near the beginning of the 
task.  

On Friday, August 16, 2024 at 12:16:40 PM UTC-6 Todd Lewis wrote:

> I'm inclined to believe someone is confused by the two hostname: 
> parameters, and would need to see some job log evidence supporting the 
> claim that "the sub[stitution] is being made for name: but not for 
> hostname:." In any case, something from the job log would/should be 
> informative.
>
> I've found in situations like this it's helpful to change to module to 
> ansible.builtin.debug: immediately followed by msg: |. You'd then need to 
> play with indentation a little to make it informative.
> On 8/16/24 1:52 PM, HBach wrote:
>
> Hi, Community,  
>
> I am passing in a list, 'vmware_hosts', to the loop in the following task 
> in order to substitute values for the name: and hostname: parameters.  I 
> have found only the sub is being made for name: but not for hostname:.  
>
> - name: Set powerstate of a virtual machine to poweron
>   community.vmware.vmware_guest:
>     hostname: "{{ vc_host_id }}"
>     username: "{{ username }}"
>     password: "{{ survey_password }}"
>     name: "{{ item }}"
>     customization:
>       existing_vm: true
>       dns_servers:
>       - "{{ dns_ns1 }}"
>       - "{{ dns_ns2 }}"
>       hostname: "{{ item }}"
>     state: poweredon
>     wait_for_ip_address: true
>   loop: "{{ vmware_hosts }}"
>   register: vm_state
>   delegate_to: localhost
>
> For each iteration of the loop, i.e. a different host, I need these two 
> parameters to hold the same value.  
>
> What am I missing here?  
>
> Thanks!  
>
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/832cd4cf-942a-48c6-b73c-25a7f48a018an%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/ansible-project/832cd4cf-942a-48c6-b73c-25a7f48a018an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
> -- 
> Todd
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c113cb06-d40c-42f0-9176-d40ddef4ac0fn%40googlegroups.com.

Reply via email to