CiscoUcs / ucsm-ansible

Ansible Modules for Cisco Ucs Managed Blade and Rack servers.
59 stars 43 forks source link

I'm able to login to UCS Manager but not UCS Central. Is Central supported? #117

Open devs429 opened 5 years ago

devs429 commented 5 years ago

I've tried escaping and not escaping the backslashes in the username.

Ansible:

- hosts: ucs
  gather_facts: no
  connection: local
  tasks:
    - name: Create test vlan
      ucs_vlans:
        hostname: 'ucscentral'
        username: 'ucs-ourdomain\user'
        password: '{{ pw }}'
        name: testing
        id: '1986'

The following works on Manager, not Central:

task path: /home/ourdomain/user/git/repo/cisco-ucs.yml:6
<10.69.200.204> ESTABLISH LOCAL CONNECTION FOR USER: user
<10.69.200.204> EXEC /bin/sh -c 'echo ~user && sleep 0'
<10.69.200.204> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/ourdomain/user/.ansible/tmp/ansible-tmp-1565728263.2-38865299534001 `" && echo ansible-tmp-1565728263.2-38865299534001="` echo /home/ourdomain/user/.ansible/tmp/ansible-tmp-1565728263.2-38865299534001 `" ) && sleep 0'
<10.69.200.204> Attempting python interpreter discovery
<10.69.200.204> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'python2.6'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; c
ommand -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0'
<10.69.200.204> EXEC /bin/sh -c '/usr/bin/python && sleep 0'
Using module file /usr/lib/python2.7/site-packages/ansible/modules/remote_management/ucs/ucs_vlans.py
<10.69.200.204> PUT /home/ourdomain/user/.ansible/tmp/ansible-local-47823cOfuwU/tmp0D6LGv TO /home/ourdomain/user/.ansible/tmp/ansible-tmp-1565728263.2-38865299534001/AnsiballZ_ucs_vlans.py
<10.69.200.204> EXEC /bin/sh -c 'chmod u+x /home/ourdomain/user/.ansible/tmp/ansible-tmp-1565728263.2-38865299534001/ /home/ourdomain/user/.ansible/tmp/ansible-tmp-1565728263.2-38865299534001/AnsiballZ_ucs_vlans.py && sleep 0'
<10.69.200.204> EXEC /bin/sh -c '/usr/bin/python /home/ourdomain/user/.ansible/tmp/ansible-tmp-1565728263.2-38865299534001/AnsiballZ_ucs_vlans.py && sleep 0'
<10.69.200.204> EXEC /bin/sh -c 'rm -f -r /home/ourdomain/user/.ansible/tmp/ansible-tmp-1565728263.2-38865299534001/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
  File "/tmp/ansible_ucs_vlans_payload_KiruPL/ansible_ucs_vlans_payload.zip/ansible/module_utils/remote_management/ucs.py", line 87, in login
    handle.login()
  File "/usr/lib/python2.7/site-packages/ucsmsdk/ucshandle.py", line 135, in login
    return self._login(auto_refresh, force, timeout=timeout)
  File "/usr/lib/python2.7/site-packages/ucsmsdk/ucssession.py", line 599, in _login
    response = self.post_elem(elem, timeout=timeout)
  File "/usr/lib/python2.7/site-packages/ucsmsdk/ucssession.py", line 318, in post_elem
    response = xc.from_xml_str(response_str, self)
  File "/usr/lib/python2.7/site-packages/ucsmsdk/ucsxmlcodec.py", line 89, in from_xml_str
    root_elem = ET.fromstring(recovered_xml)
  File "<string>", line 124, in XML

fatal: [10.69.200.204]: FAILED! => changed=false
  ansible_facts:
    discovered_interpreter_python: /usr/bin/python
  invocation:
    module_args:
      fabric: common
      hostname: 10.69.200.204
      id: '1986'
      multicast_policy: ''
      name: testing
      native: 'no'
      password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
      port: null
      proxy: null
      sharing: none
      state: present
      use_proxy: true
      use_ssl: true
      username: ucs-ourdomain\user
  msg: 'syntax error: line 1, column 0'