ansible-collections / cisco.ios

Ansible Network Collection for Cisco IOS
GNU General Public License v3.0
293 stars 171 forks source link

Having length command in line vty block hangs playbook execution #299

Closed maugli13 closed 3 years ago

maugli13 commented 3 years ago
SUMMARY

When I'm trying to configure terminal length under line vty configuration section using ios_command module, ansible hangs forever

ISSUE TYPE
COMPONENT NAME

ios_command

ANSIBLE VERSION
ansible 2.10.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/murmanov/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/murmanov/.local/lib/python3.7/site-packages/ansible
  executable location = /home/murmanov/.local/bin/ansible
  python version = 3.7.9 (default, Aug 18 2020, 06:22:45) [GCC 7.5.0]
CONFIGURATION
murmanov@pynengvm:~$ ansible-config dump --only-changed
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
INTERPRETER_PYTHON(/etc/ansible/ansible.cfg) = /usr/bin/python3
PERSISTENT_COMMAND_TIMEOUT(/etc/ansible/ansible.cfg) = 180
PERSISTENT_CONNECT_TIMEOUT(/etc/ansible/ansible.cfg) = 180
OS / ENVIRONMENT

Device: WS-C2960X-48TD-L Software version: 15.2(2)E7

STEPS TO REPRODUCE
- name: "ACL configuration"
  hosts: lgb3-ios-mgmt
  gather_facts: no

  tasks:

    - name: Configure length
      ios_config:
        lines:
          - length 48
        before: line vty 0 15
        save_when: changed
        diff_against: running
EXPECTED RESULTS

The expected result to have terminal length configured under line vty 0 15

ACTUAL RESULTS

Tried to use ios_command lines and src in both situations I see that command has been pasted to the device, however task hangs forever

$ ansible-playbook -vvvv --diff dev_configure_ssh_access.yml --limit=lgb3-mgmt02.int
ansible-playbook 2.10.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/murmanov/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/murmanov/.local/lib/python3.7/site-packages/ansible
  executable location = /home/murmanov/.local/bin/ansible-playbook
  python version = 3.7.9 (default, Aug 18 2020, 06:22:45) [GCC 7.5.0]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Not replacing invalid character(s) "{'-'}" in group name (lgb3-ios-all)
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
Not replacing invalid character(s) "{'-'}" in group name (lgb3-ios-all)
Not replacing invalid character(s) "{'-'}" in group name (lgb3-ios-all)
Not replacing invalid character(s) "{'-'}" in group name (lgb3-ios-mgmt)
Not replacing invalid character(s) "{'-'}" in group name (lgb3-ios-mgmt)
Not replacing invalid character(s) "{'-'}" in group name (lgb3-pafw-all)
Not replacing invalid character(s) "{'-'}" in group name (lgb3-pafw-all)
Not replacing invalid character(s) "{'-'}" in group name (lgb3-pafw-all)
Not replacing invalid character(s) "{'-'}" in group name (fr-qa-pa-fw)
Not replacing invalid character(s) "{'-'}" in group name (fr-qa-pa-fw)
Parsed /etc/ansible/hosts inventory source with ini plugin
redirecting (type: modules) ansible.builtin.ios_config to cisco.ios.ios_config
Loading collection cisco.ios from /home/murmanov/.ansible/collections/ansible_collections/cisco/ios
Loading callback plugin default of type stdout, v2.0 from /home/murmanov/.local/lib/python3.7/site-packages/ansible/plugins/callback/default.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: dev_configure_ssh_access.yml ********************************************************************************************************************************************************************************************
Positional arguments: dev_configure_ssh_access.yml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
diff: True
inventory: ('/etc/ansible/hosts',)
subset: lgb3-mgmt02.int
forks: 5
1 plays in dev_configure_ssh_access.yml
Read vars_file 'vars/iosaclvars.yaml'
Read vars_file 'vars/iosaclvars.yaml'
Read vars_file 'vars/iosaclvars.yaml'

PLAY [ACL configuration] **********************************************************************************************************************************************************************************************************
Read vars_file 'vars/iosaclvars.yaml'
META: ran handlers
Read vars_file 'vars/iosaclvars.yaml'

TASK [Check line vty 0-15] ********************************************************************************************************************************************************************************************************
task path: /home/murmanov/repos/NetworkAutomation/devansible/ios/dev_configure_ssh_access.yml:29
Loading collection ansible.netcommon from /home/murmanov/.ansible/collections/ansible_collections/ansible/netcommon
<lgb3-mgmt02.int> attempting to start connection
<lgb3-mgmt02.int> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /home/murmanov/.local/bin/ansible-connection
<lgb3-mgmt02.int> local domain socket does not exist, starting it
<lgb3-mgmt02.int> control socket path is /home/murmanov/.ansible/pc/260d04df85
<lgb3-mgmt02.int> Loading collection ansible.netcommon from /home/murmanov/.ansible/collections/ansible_collections/ansible/netcommon
<lgb3-mgmt02.int> Loading collection cisco.ios from /home/murmanov/.ansible/collections/ansible_collections/cisco/ios
<lgb3-mgmt02.int> local domain socket listeners started successfully
<lgb3-mgmt02.int> loaded cliconf plugin ansible_collections.cisco.ios.plugins.cliconf.ios from path /home/murmanov/.ansible/collections/ansible_collections/cisco/ios/plugins/cliconf/ios.py for network_os cisco.ios.ios
<lgb3-mgmt02.int> 
<lgb3-mgmt02.int> local domain socket path is /home/murmanov/.ansible/pc/260d04df85
redirecting (type: action) ansible.builtin.ios to cisco.ios.ios
redirecting (type: action) ansible.builtin.ios to cisco.ios.ios
<lgb3-mgmt02.int> ANSIBLE_NETWORK_IMPORT_MODULES: disabled
<lgb3-mgmt02.int> ANSIBLE_NETWORK_IMPORT_MODULES: module execution time may be extended
<lgb3-mgmt02.int> ESTABLISH LOCAL CONNECTION FOR USER: murmanov
<lgb3-mgmt02.int> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/murmanov/.ansible/tmp/ansible-local-9962dtkx2v3 `"&& mkdir "` echo /home/murmanov/.ansible/tmp/ansible-local-9962dtkx2v3/ansible-tmp-1618339422.1932554-1002-169355608155426 `" && echo ansible-tmp-1618339422.1932554-1002-169355608155426="` echo /home/murmanov/.ansible/tmp/ansible-local-9962dtkx2v3/ansible-tmp-1618339422.1932554-1002-169355608155426 `" ) && sleep 0'
redirecting (type: modules) ansible.builtin.ios_config to cisco.ios.ios_config
Using module file /home/murmanov/.ansible/collections/ansible_collections/cisco/ios/plugins/modules/ios_config.py
<lgb3-mgmt02.int> PUT /home/murmanov/.ansible/tmp/ansible-local-9962dtkx2v3/tmp7llnudr7 TO /home/murmanov/.ansible/tmp/ansible-local-9962dtkx2v3/ansible-tmp-1618339422.1932554-1002-169355608155426/AnsiballZ_ios_config.py
<lgb3-mgmt02.int> EXEC /bin/sh -c 'chmod u+x /home/murmanov/.ansible/tmp/ansible-local-9962dtkx2v3/ansible-tmp-1618339422.1932554-1002-169355608155426/ /home/murmanov/.ansible/tmp/ansible-local-9962dtkx2v3/ansible-tmp-1618339422.1932554-1002-169355608155426/AnsiballZ_ios_config.py && sleep 0'
<lgb3-mgmt02.int> EXEC /bin/sh -c '/usr/bin/python3 /home/murmanov/.ansible/tmp/ansible-local-9962dtkx2v3/ansible-tmp-1618339422.1932554-1002-169355608155426/AnsiballZ_ios_config.py && sleep 0'
<lgb3-mgmt02.int> EXEC /bin/sh -c 'rm -f -r /home/murmanov/.ansible/tmp/ansible-local-9962dtkx2v3/ansible-tmp-1618339422.1932554-1002-169355608155426/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
  File "/tmp/ansible_ios_config_payload_e453n2xi/ansible_ios_config_payload.zip/ansible_collections/cisco/ios/plugins/module_utils/network/ios/ios.py", line 141, in run_commands
    return connection.run_commands(commands=commands, check_rc=check_rc)
  File "/tmp/ansible_ios_config_payload_e453n2xi/ansible_ios_config_payload.zip/ansible/module_utils/connection.py", line 195, in __rpc__
    raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
fatal: [lgb3-mgmt02.int]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "after": null,
            "backup": false,
            "backup_options": null,
            "before": [
                "line vty 0 15"
            ],
            "defaults": false,
            "diff_against": "running",
            "diff_ignore_lines": null,
            "intended_config": null,
            "lines": [
                "length 48"
            ],
            "match": "line",
            "multiline_delimiter": "@",
            "parents": null,
            "provider": null,
            "replace": "line",
            "running_config": null,
            "save_when": "changed",
            "src": null
        }
    },
    "msg": "command timeout triggered, timeout value is 180 secs.\nSee the timeout setting options in the Network Debug and Troubleshooting Guide."
}

PLAY RECAP ************************************************************************************************************************************************************************************************************************
lgb3-mgmt02.int            : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
NilashishC commented 3 years ago

cc @KB-perByte

KB-perByte commented 3 years ago

@maugli13 Was unable to reproduce the issue on my end, Can you please try increasing the time to a bit greater value and check?

KB-perByte commented 3 years ago

Hi @maugli13, as the issue is inactive and is waiting on the info we’re closing the issue, plz reopen a new issue if you’re still facing the reported issue