Developer

last person joined: yesterday 

Expand all | Collapse all

Ansible error, unterminated character set at position 0

This thread has been viewed 93 times
  • 1.  Ansible error, unterminated character set at position 0

    Posted Jun 23, 2021 01:38 PM
    Hello,

    Has anyone seen this error recently?

    Running the playbook with -vvvv I get:

    The full traceback is:
    File "/tmp/ansible_aoscx_config_payload_9q0pzltx/ansible_aoscx_config_payload.zip/ansible/module_utils/aoscx.py", line 397, in run_commands
    return conn.run_commands(commands=commands, check_rc=check_rc)
    File "/tmp/ansible_aoscx_config_payload_9q0pzltx/ansible_aoscx_config_payload.zip/ansible/module_utils/connection.py", line 195, in __rpc__
    raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
    fatal: [test-sw.colgate.edu]: FAILED! => changed=false
    invocation:
    module_args:
    after: null
    backup: false
    backup_options: null
    before: null
    diff_against: null
    diff_ignore_lines: null
    intended_config: null
    lines: null
    match: line
    parents: null
    provider: null
    replace: line
    running_config: null
    save_when: modified
    src: null
    msg: unterminated character set at position 0​



    I recently upgrade to arubanetworks.aoscx_role (3.0.0)

    $ ansible --version
    ansible [core 2.11.1]
    config file = /etc/ansible/ansible.cfg
    configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
    ansible python module location = /home/user/.local/lib/python3.8/site-packages/ansible
    ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
    executable location = /home/user/.local/bin/ansible
    python version = 3.8.5 (default, May 27 2021, 13:30:53) [GCC 9.3.0]
    jinja version = 2.10.1
    libyaml = True


    Non-AOSCX (role) based playbooks work without issue.


    ------------------------------
    Don Rhodes
    ------------------------------


  • 2.  RE: Ansible error, unterminated character set at position 0

    Posted Jun 25, 2021 07:21 AM
    Hi Don,

    Do you have update also pyaos module ?

    ------------------------------
    PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...

    PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)

    PowerArubaCL: Powershell Module to use Aruba Central

    PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..

    ACEP / ACMX #107 / ACDX #1281
    ------------------------------



  • 3.  RE: Ansible error, unterminated character set at position 0

    Posted Jun 27, 2021 05:11 PM
    Damm even I am having a similar kind of issue, I have searched all over the internet and even have posted on number of threads on different forum, no solution seems to work. I am really frustrated, can anyone of you here help me resolve this issue, I am very much tired now.

    ------------------------------
    Shubhampaul Shubhampaul
    ------------------------------



  • 4.  RE: Ansible error, unterminated character set at position 0

    Posted Jun 28, 2021 06:57 AM
    do you have check the pyaoscx release ?

    ------------------------------
    PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...

    PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)

    PowerArubaCL: Powershell Module to use Aruba Central

    PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..

    ACEP / ACMX #107 / ACDX #1281
    ------------------------------



  • 5.  RE: Ansible error, unterminated character set at position 0

    Posted Jun 29, 2021 01:48 PM

    Hi,

    Can you share your version of your ansible collection (ansible-galaxy collection list)
    Because I suspect the issue comes from the ansible.netcommon





  • 6.  RE: Ansible error, unterminated character set at position 0

    Posted Jun 29, 2021 01:21 AM
    Hi all,

    I've seen this error with multiple versions of Ansible installed (through a package installer as well as through a pip install). Can you ensure only 1 version of Ansible exists and try executing again?

    Through package installer (Ubuntu):
    `apt list --installed `

    Through pip:
    `python3 -m pip list`

    Ensure there's only 1 ansible-base or ansible-core according to Ansible's documentation.

    For instructions on how to install Ansible refer to their documentation here:

    ------------------------------
    Tiffany Chiapuzio-Wong
    ------------------------------



  • 7.  RE: Ansible error, unterminated character set at position 0

    Posted Jun 30, 2021 10:51 AM
    Tiffany, I got the same error when i use ansible 3( ansible-base) or 4(ansible-core), working with aoscx role.
    but it works when I use 2.9.23, for the same playbook. (btw ansible built-in module, like debug works)


    (ansible1) root@ubuntu:/home/student/test/product# python3 -m pip list
    Package Version ------------- ---------
    ansible 3.0.0
    ansible-base 2.10.11
    bcrypt 3.2.0
    certifi 2021.5.30
    cffi 1.14.5 chardet 4.0.0 cryptography 3.4.7
    idna 2.10
    Jinja2 3.0.1
    MarkupSafe 2.0.1
    packaging 20.9
    paramiko 2.7.2
    pip 20.0.2
    pkg-resources 0.0.0
    pyaoscx 2.0.0
    pycparser 2.20
    PyNaCl 1.4.0
    pyparsing 2.4.7
    PyYAML 5.4.1
    requests 2.25.1
    resolvelib 0.5.4
    setuptools 44.0.0 six 1.16.0 urllib3 1.26.6






    ------------------------------
    Kevin Zhu
    ------------------------------



  • 8.  RE: Ansible error, unterminated character set at position 0

    Posted Jun 30, 2021 10:52 AM
    I got same error when i use ansible3 or 4 working with ansible aoscx ssh module.

    for my case:
    1. 2.9.23, everything including ssh/httpapi/built-in modules working good
    2. ansible 3(ansible-base 2.10) or ansible 4(ansible-core):
       1. built-in module works
       2. httpapi modules works
       3. network_cli, ssh module not working.

    btw, there is only one ansible-base or ansible-core was running.

    ------------------------------
    Kevin Zhu
    ------------------------------



  • 9.  RE: Ansible error, unterminated character set at position 0

    Posted Jun 30, 2021 02:33 PM
    Which python version are you using? Are you running this in a docker container at all?

    In my experience when using the new Ansible versions (3/4) python 3.8 is required.

    ------------------------------
    Tiffany Chiapuzio-Wong
    ------------------------------



  • 10.  RE: Ansible error, unterminated character set at position 0

    Posted Jul 07, 2021 11:52 AM
    Sorry for the long delay in responding.



    I started out with 'two version of Ansible installed':

    ~$ apt list --installed | grep ansible
    ansible/focal,now 2.9.6+dfsg-1 all [installed]
    
    ~$ python3 -m pip list | grep ansible
    ansible                            4.0.0
    ansible-core                       2.11.1
    ​

    So I removed all of it:

    pip uninstall ansible
    pip uninstall ansible-core
    
    sudo apt remove ansible​

    I installed it via APT, I am using Ubuntu 20.04.2 LTS   Windows Subsystem for Linux.

    sudo apt update
    sudo apt install software-properties-common
    sudo add-apt-repository --yes --update ppa:ansible/ansible
    sudo apt install ansible​


    I received the following error after installing it:
    ~$ ansible --version
    -bash: /home/user/.local/bin/ansible: No such file or directory​


    So i removed it and installed it via PIP, and it runs this time:

    ~$ ansible --version
    ansible [core 2.11.2]
      config file = /etc/ansible/ansible.cfg
      configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
      ansible python module location = /home/user/.local/lib/python3.8/site-packages/ansible
      ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
      executable location = /home/user/.local/bin/ansible
      python version = 3.8.10 (default, Jun  2 2021, 10:49:15) [GCC 9.4.0]
      jinja version = 2.10.1
      libyaml = True



    However the playbook still runs with the original error.

    ~$ python3 -m pip list
    Package                            Version
    ---------------------------------- --------------------
    ansible                            4.2.0
    ansible-core                       2.11.2
    attrs                              19.3.0
    Automat                            0.8.0
    bcrypt                             3.2.0
    blinker                            1.4
    certifi                            2019.11.28
    cffi                               1.14.3
    chardet                            3.0.4
    Click                              7.0
    cloud-init                         21.2
    colorama                           0.4.3
    command-not-found                  0.3
    configobj                          5.0.6
    constantly                         15.1.0
    cryptography                       2.8
    dbus-python                        1.2.16
    decorator                          4.4.2
    distro                             1.4.0
    distro-info                        0.23ubuntu1
    entrypoints                        0.3
    httplib2                           0.14.0
    hyperlink                          19.0.0
    idna                               2.8
    importlib-metadata                 1.5.0
    incremental                        16.10.1
    Jinja2                             2.10.1
    jsonpatch                          1.22
    jsonpointer                        2.0
    jsonschema                         3.2.0
    keyring                            18.0.1
    language-selector                  0.1
    launchpadlib                       1.10.13
    lazr.restfulclient                 0.14.2
    lazr.uri                           1.0.3
    lxml                               4.6.3
    MarkupSafe                         1.1.0
    more-itertools                     4.2.0
    netifaces                          0.10.4
    nftables                           0.1
    nsx-policy-python-sdk              3.0.3.0.0.17723277
    nsx-python-sdk                     3.0.3.0.0.17723277
    nsx-vmc-aws-integration-python-sdk 3.0.3.0.0.17723277
    nsx-vmc-policy-python-sdk          3.0.3.0.0.17723277
    oauthlib                           3.1.0
    packaging                          20.9
    paramiko                           2.7.2
    pexpect                            4.6.0
    pip                                20.0.2
    pyaoscx                            2.0.0
    pyasn1                             0.4.2
    pyasn1-modules                     0.2.1
    pycparser                          2.20
    pycrypto                           2.6.1
    PyGObject                          3.36.0
    PyHamcrest                         1.9.0
    PyJWT                              1.7.1
    PyNaCl                             1.4.0
    pyOpenSSL                          19.0.0
    pyparsing                          2.4.7
    pyrsistent                         0.15.5
    pyserial                           3.4
    python-apt                         2.0.0+ubuntu0.20.4.5
    python-debian                      0.1.36ubuntu1
    pyvmomi                            7.0.1
    PyYAML                             5.3.1
    requests                           2.22.0
    requests-unixsocket                0.2.0
    resolvelib                         0.5.4
    SecretStorage                      2.3.1
    selinux                            3.0
    service-identity                   18.1.0
    setuptools                         45.2.0
    simplejson                         3.16.0
    six                                1.14.0
    slip                               0.6.5
    slip.dbus                          0.6.5
    sos                                4.1
    ssh-import-id                      5.10
    suds-jurko                         0.6
    systemd-python                     234
    Twisted                            18.9.0
    ubuntu-advantage-tools             27.0
    ufw                                0.36
    unattended-upgrades                0.1
    urllib3                            1.25.8
    vapi-client-bindings               3.5.0
    vapi-common-client                 2.19.0
    vapi-runtime                       2.19.0
    vmc-client-bindings                1.36.0
    vmc-draas-client-bindings          1.17.0
    vSphere-Automation-SDK             1.51.0
    wadllib                            1.3.3
    wheel                              0.34.2
    zipp                               1.0.0
    zope.interface                     4.7.1
    
    
    
    ~$ python --version
    Python 2.7.18
    
    ~$ python3 --version
    Python 3.8.10






    ------------------------------
    Don Rhodes
    ------------------------------



  • 11.  RE: Ansible error, unterminated character set at position 0

    Posted Jul 07, 2021 06:08 PM
    Can you try updating the netcommon collection and see if that changes your output?
    `ansible-galaxy collection install ansible.netcommon -f`


    ------------------------------
    Tiffany Chiapuzio-Wong
    ------------------------------



  • 12.  RE: Ansible error, unterminated character set at position 0

    Posted Jul 08, 2021 08:23 AM

    Here is the output:

    :~$ ansible-galaxy collection install ansible.netcommon -f
    Starting galaxy collection install process
    Process install dependency map
    Starting collection install process
    Downloading https://galaxy.ansible.com/download/ansible-netcommon-2.2.0.tar.gz to /home/user/.ansible/tmp/ansible-local-18385k64umbn7/tmp3g9bgmm8/ansible-netcommon-2.2.0-868w6ert
    Installing 'ansible.netcommon:2.2.0' to '/home/user/.ansible/collections/ansible_collections/ansible/netcommon'
    ansible.netcommon:2.2.0 was installed successfully
    Skipping 'ansible.utils:2.2.0' as it is already installed​

    In case this is helpful

    :~$ ansible-galaxy collection list
    
    # /home/user/.ansible/collections/ansible_collections
    Collection          Version
    ------------------- -------
    ansible.netcommon   2.2.0
    ansible.utils       2.2.0
    arubanetworks.aoscx 2.1.1
    cisco.ios           1.1.0
    
    # /home/user/.local/lib/python3.8/site-packages/ansible_collections
    Collection                    Version
    ----------------------------- -------
    amazon.aws                    1.5.0
    ansible.netcommon             2.2.0
    ansible.posix                 1.2.0
    ansible.utils                 2.3.0
    ansible.windows               1.7.0
    arista.eos                    2.2.0
    awx.awx                       19.2.2
    azure.azcollection            1.7.0
    check_point.mgmt              2.0.0
    chocolatey.chocolatey         1.1.0
    cisco.aci                     2.0.0
    cisco.asa                     2.0.2
    cisco.intersight              1.0.15
    cisco.ios                     2.3.0
    cisco.iosxr                   2.3.0
    cisco.meraki                  2.4.2
    cisco.mso                     1.2.0
    cisco.nso                     1.0.3
    cisco.nxos                    2.4.0
    cisco.ucs                     1.6.0
    cloudscale_ch.cloud           2.2.0
    community.aws                 1.5.0
    community.azure               1.0.0
    community.crypto              1.7.1
    community.digitalocean        1.7.0
    community.docker              1.8.0
    community.fortios             1.0.0
    community.general             3.3.0
    community.google              1.0.0
    community.grafana             1.2.1
    community.hashi_vault         1.3.0
    community.hrobot              1.1.1
    community.kubernetes          1.2.1
    community.kubevirt            1.0.0
    community.libvirt             1.0.1
    community.mongodb             1.2.1
    community.mysql               2.1.0
    community.network             3.0.0
    community.okd                 1.1.2
    community.postgresql          1.3.0
    community.proxysql            1.0.0
    community.rabbitmq            1.0.3
    community.routeros            1.2.0
    community.skydive             1.0.0
    community.sops                1.1.0
    community.vmware              1.11.0
    community.windows             1.5.0
    community.zabbix              1.3.0
    containers.podman             1.6.1
    cyberark.conjur               1.1.0
    cyberark.pas                  1.0.7
    dellemc.enterprise_sonic      1.1.0
    dellemc.openmanage            3.5.0
    dellemc.os10                  1.1.1
    dellemc.os6                   1.0.7
    dellemc.os9                   1.0.4
    f5networks.f5_modules         1.10.1
    fortinet.fortimanager         2.1.2
    fortinet.fortios              2.1.1
    frr.frr                       1.0.3
    gluster.gluster               1.0.1
    google.cloud                  1.0.2
    hetzner.hcloud                1.4.3
    hpe.nimble                    1.1.3
    ibm.qradar                    1.0.3
    infinidat.infinibox           1.2.4
    inspur.sm                     1.2.0
    junipernetworks.junos         2.3.0
    kubernetes.core               1.2.1
    mellanox.onyx                 1.0.0
    netapp.aws                    21.2.0
    netapp.azure                  21.7.0
    netapp.cloudmanager           21.7.0
    netapp.elementsw              21.6.1
    netapp.ontap                  21.7.0
    netapp.um_info                21.6.0
    netapp_eseries.santricity     1.2.13
    netbox.netbox                 3.1.1
    ngine_io.cloudstack           2.1.0
    ngine_io.exoscale             1.0.0
    ngine_io.vultr                1.1.0
    openstack.cloud               1.5.0
    openvswitch.openvswitch       2.0.0
    ovirt.ovirt                   1.5.3
    purestorage.flasharray        1.8.0
    purestorage.flashblade        1.6.0
    sensu.sensu_go                1.11.1
    servicenow.servicenow         1.0.6
    splunk.es                     1.0.2
    t_systems_mms.icinga_director 1.18.0
    theforeman.foreman            2.1.1
    vyos.vyos                     2.3.1
    wti.remote                    1.0.1​


    ------------------------------
    Don Rhodes
    ------------------------------



  • 13.  RE: Ansible error, unterminated character set at position 0

    Posted Jul 08, 2021 08:37 AM
    delete this port


  • 14.  RE: Ansible error, unterminated character set at position 0

    Posted Jul 08, 2021 02:14 PM
    Still the same error message?

    ------------------------------
    Tiffany Chiapuzio-Wong
    ------------------------------



  • 15.  RE: Ansible error, unterminated character set at position 0

    Posted Jul 08, 2021 04:53 PM
    Yes.

    ~$ ansible-playbook --vault-password-file ~/.ansible/ansible-aoscx-passwordfile -i ~/ansible_git/playbooks/aoscx/ansible-aoscx-inventory.yml ~/ansible_git/playbooks/aoscx/dev/ansible-aoscx-save-config.yml
    
    PLAY [Testing] **********************************************************************************************************************************
    
    TASK [Save and backup running-configuration] ****************************************************************************************************
    included: /home/user/ansible_git/playbooks/aoscx/tasks/ansible-aoscx-task-save-and-copy-config-to-tftp.yml for test1-office-sw.colgate.edu, test2-office-sw.colgate.edu
    
    TASK [__INCLUDED_TASK__ Save the running-config] ************************************************************************************************
    fatal: [test2-office-sw.colgate.edu]: FAILED! => changed=false
      msg: unterminated character set at position 0
    fatal: [test1-office-sw.colgate.edu]: FAILED! => changed=false
      msg: unterminated character set at position 0
    
    PLAY RECAP **************************************************************************************************************************************
    test1-office-sw.colgate.edu  : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
    test2-office-sw.colgate.edu  : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0​


    ------------------------------
    Don Rhodes
    ------------------------------



  • 16.  RE: Ansible error, unterminated character set at position 0

    Posted Aug 11, 2021 04:27 PM
    I was getting the issue , using a virtualenv and installing the latest ansible release through pip install.
    Recreating my virtualenv, and forcing a release of ansible < 2.10 corrected this issue.
    pip install ansible==2.9.24


    ------------------------------
    Tangi CURET
    ------------------------------