but when i put static value into the main.yml file it works

---
- name: "change the root password"
  hosts: localhost
  tasks:
    - name: "change root pass"
      community.vmware.vmware_local_user_manager:
       hostname: ""esx1"
       username: "root"
       password: "xxx!"
       local_user_name: "root"
       local_user_password: "yyy"
       state: present
       validate_certs: no

On Monday, October 26, 2020 at 10:34:51 AM UTC-7 Tony Wong wrote:

>
> inventory file
>
> [esx]
> esx1
> esx2
> esx3
> [esx:vars]
> ansible_python_interpreter=/usr/bin/python3
>
> ---------------------------------------------------------
>
> answer file
>
> esxi_hostname: '{{ inventory_hostname }}'
> esxi_root_user: 'root'
> esxi_root_pass: 'xxx'
> new_esx_local_root_user: 'root'
> new_esx_local_root_pass: 'yyy'
>
> -------------------------------------------------
>
> playbook file
>
> ---
> - name: "change the root password"
>   hosts: localhost
>   tasks:
>     - name: "change root pass"
>       community.vmware.vmware_local_user_manager:
>        hostname: " {{ esxi_hostname }}"
>        username: " {{ esxi_root_user }}"
>        password: " {{ esxi_root_pass }}"
>        local_user_name: "{{ new_esx_local_root_user }}"
>        local_user_password: "{{ new_esx_local_root_pass }}"
>        state: present
>        validate_certs: no
>
>     - name: print results
>       debug: msg=" {{ result }}"
>   vars_files:
>     - answerfile.yml
>
>
> when i run it with
> ansible-playbook -i hosts main.yml -u root --ask-pass -vvvv
>
> i keep getting error
>
>
>
> The full traceback is:
> WARNING: The below traceback may *not* be related to the actual failure.
>   File 
> "/tmp/ansible_community.vmware.vmware_local_user_manager_payload_GG4F7i/ansible_community.vmware.vmware_local_user_manager_payload.zip/ansible_collections/community/vmware/plugins/module_utils/vmware.py",
>  
> line 577, in connect_to_api
>     service_instance = connect.SmartConnect(**connect_args)
>   File "/usr/lib/python2.7/dist-packages/pyVim/connect.py", line 836, in 
> SmartConnect
>     sslContext)
>   File "/usr/lib/python2.7/dist-packages/pyVim/connect.py", line 718, in 
> __FindSupportedVersion
>     sslContext)
>   File "/usr/lib/python2.7/dist-packages/pyVim/connect.py", line 638, in 
> __GetServiceVersionDescription
>     path + "/vimServiceVersions.xml", sslContext)
>   File "/usr/lib/python2.7/dist-packages/pyVim/connect.py", line 604, in 
> __GetElementTree
>     conn.request("GET", path)
>   File "/usr/lib/python2.7/httplib.py", line 1069, in request
>     self._send_request(method, url, body, headers)
>   File "/usr/lib/python2.7/httplib.py", line 1109, in _send_request
>     self.endheaders(body)
>   File "/usr/lib/python2.7/httplib.py", line 1065, in endheaders
>     self._send_output(message_body)
>   File "/usr/lib/python2.7/httplib.py", line 892, in _send_output
>     self.send(msg)
>   File "/usr/lib/python2.7/httplib.py", line 854, in send
>     self.connect()
>   File "/usr/lib/python2.7/httplib.py", line 1282, in connect
>     HTTPConnection.connect(self)
>   File "/usr/lib/python2.7/httplib.py", line 831, in connect
>     self.timeout, self.source_address)
>   File "/usr/lib/python2.7/socket.py", line 557, in create_connection
>     for res in getaddrinfo(host, port, 0, SOCK_STREAM):
> fatal: [localhost]: FAILED! => {
>     "changed": false,
>     "invocation": {
>         "module_args": {
>             "hostname": " localhost",
>             "local_user_description": null,
>             "local_user_name": "root",
>             "local_user_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
>             "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
>             "port": 443,
>             "proxy_host": null,
>             "proxy_port": null,
>             "state": "present",
>             "username": " root",
>             "validate_certs": false
>         }
>     },
>     "msg": "Unknown error while connecting to vCenter or ESXi API at  
> localhost:443 : [Errno -2] Name or service not known"
> }
>
>

-- 
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/ee9f3c8f-b572-4028-8be7-85a0120bf2a2n%40googlegroups.com.

Reply via email to