ansible-collections / cisco.ios

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

Cisco CSR1000V IOS-XE: class-map type control subscriber match-all DOT1X_FAILED, Delayed Prompt Issue #880

Closed vjs-tec closed 1 year ago

vjs-tec commented 1 year ago
SUMMARY
ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
root@vijay-virtual-machine://etc/ansible# ansible --version
[WARNING]: Ansible is being run in a world writable directory (/etc/ansible), ignoring it as an
ansible.cfg source. For more information see
https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir
ansible [core 2.15.1]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible
  ansible collection location = /usr/local/lib/python3.10/dist-packages/ansible_collections
  executable location = /usr/local/bin/ansible
  python version = 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
root@vijay-virtual-machine://etc/ansible# ansible-galaxy collection list
[WARNING]: Ansible is being run in a world writable directory (/etc/ansible), ignoring it as an
ansible.cfg source. For more information see
https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir
[DEPRECATION WARNING]: DEFAULT_GATHER_SUBSET option, the module_defaults keyword is a more generic 
version and can apply to all calls to the M(ansible.builtin.gather_facts) or 
M(ansible.builtin.setup) actions, use module_defaults instead. This feature will be removed from 
ansible-core in version 2.18. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.

# /usr/lib/python3/dist-packages/ansible_collections
Collection                    Version
----------------------------- -------
amazon.aws                    5.5.1  
ansible.netcommon             4.1.0  
ansible.posix                 1.5.4  
ansible.utils                 2.10.3 
ansible.windows               1.14.0 
arista.eos                    6.0.1  
awx.awx                       21.14.0
azure.azcollection            1.16.0 
check_point.mgmt              4.0.0  
chocolatey.chocolatey         1.4.0  
cisco.aci                     2.6.0  
cisco.asa                     4.0.1  
cisco.dnac                    6.7.2  
cisco.intersight              1.0.27 
cisco.ios                     4.6.1  
cisco.iosxr                   4.1.0  
cisco.ise                     2.5.12 
cisco.meraki                  2.15.1 
cisco.mso                     2.4.0  
cisco.nso                     1.0.3  
cisco.nxos                    4.4.0  
cisco.ucs                     1.8.0  
cloud.common                  2.1.3  
cloudscale_ch.cloud           2.3.1  
community.aws                 5.5.0  
community.azure               2.0.0  
community.ciscosmb            1.0.6  
community.crypto              2.14.0 
community.digitalocean        1.23.0 
community.dns                 2.5.5  
community.docker              3.4.7  
community.fortios             1.0.0  
community.general             6.6.2  
community.google              1.0.0  
community.grafana             1.5.4  
community.hashi_vault         4.2.1  
community.hrobot              1.8.0  
community.libvirt             1.2.0  
community.mongodb             1.6.0  
community.mysql               3.7.2  
community.network             5.0.0  
community.okd                 2.3.0  
community.postgresql          2.4.2  
community.proxysql            1.5.1  
community.rabbitmq            1.2.3  
community.routeros            2.8.2  
community.sap                 1.0.0  
community.sap_libs            1.4.1  
community.skydive             1.0.0  
community.sops                1.6.2  
community.vmware              3.7.0  
community.windows             1.13.0 
community.zabbix              1.9.3  
containers.podman             1.10.2 
cyberark.conjur               1.2.0  
cyberark.pas                  1.0.19 
dellemc.enterprise_sonic      2.0.0  
dellemc.openmanage            6.3.0  
dellemc.os10                  1.1.1  
dellemc.os6                   1.0.7  
dellemc.os9                   1.0.4  
dellemc.powerflex             1.6.0  
dellemc.unity                 1.6.0  
f5networks.f5_modules         1.25.0 
fortinet.fortimanager         2.2.0  
fortinet.fortios              2.3.0  
frr.frr                       2.0.2  
gluster.gluster               1.0.2  
google.cloud                  1.1.3  
grafana.grafana               1.1.1  
hetzner.hcloud                1.11.0 
hpe.nimble                    1.1.4  
ibm.qradar                    2.1.0  
ibm.spectrum_virtualize       1.12.0 
infinidat.infinibox           1.3.12 
infoblox.nios_modules         1.5.0  
inspur.ispim                  1.3.0  
inspur.sm                     2.3.0  
junipernetworks.junos         4.1.0  
kubernetes.core               2.4.0  
lowlydba.sqlserver            1.3.1  
mellanox.onyx                 1.0.0  
microsoft.ad                  1.2.0  
netapp.aws                    21.7.0 
netapp.azure                  21.10.0
netapp.cloudmanager           21.22.0
netapp.elementsw              21.7.0 
netapp.ontap                  22.7.0 
netapp.storagegrid            21.11.1
netapp.um_info                21.8.0 
netapp_eseries.santricity     1.4.0  
netbox.netbox                 3.13.0 
ngine_io.cloudstack           2.3.0  
ngine_io.exoscale             1.0.0  
ngine_io.vultr                1.1.3  
openstack.cloud               1.10.0 
openvswitch.openvswitch       2.1.1  
ovirt.ovirt                   2.4.1  
purestorage.flasharray        1.19.1 
purestorage.flashblade        1.11.0 
purestorage.fusion            1.5.0  
sensu.sensu_go                1.13.2 
splunk.es                     2.1.0  
t_systems_mms.icinga_director 1.33.1 
theforeman.foreman            3.11.0 
vmware.vmware_rest            2.3.1  
vultr.cloud                   1.8.0  
vyos.vyos                     4.1.0  
wti.remote                    1.0.5  

# /usr/local/lib/python3.10/dist-packages/ansible_collections
Collection                    Version
----------------------------- -------
amazon.aws                    6.1.0  
ansible.netcommon             5.1.1  
ansible.posix                 1.5.4  
ansible.utils                 2.10.3 
ansible.windows               1.14.0 
arista.eos                    6.0.1  
awx.awx                       22.3.0 
azure.azcollection            1.16.0 
check_point.mgmt              5.1.1  
chocolatey.chocolatey         1.4.0  
cisco.aci                     2.6.0  
cisco.asa                     4.0.1  
cisco.dnac                    6.7.2  
cisco.intersight              1.0.27 
cisco.ios                     4.6.1  
cisco.iosxr                   5.0.3  
cisco.ise                     2.5.12 
cisco.meraki                  2.15.1 
cisco.mso                     2.4.0  
cisco.nso                     1.0.3  
cisco.nxos                    4.4.0  
cisco.ucs                     1.8.0  
cloud.common                  2.1.3  
cloudscale_ch.cloud           2.3.1  
community.aws                 6.0.0  
community.azure               2.0.0  
community.ciscosmb            1.0.6  
community.crypto              2.14.0 
community.digitalocean        1.23.0 
community.dns                 2.5.6  
community.docker              3.4.8  
community.fortios             1.0.0  
community.general             7.1.0  
community.google              1.0.0  
community.grafana             1.5.4  
community.hashi_vault         5.0.0  
community.hrobot              1.8.0  
community.libvirt             1.2.0  
community.mongodb             1.6.0  
community.mysql               3.7.2  
community.network             5.0.0  
community.okd                 2.3.0  
community.postgresql          2.4.2  
community.proxysql            1.5.1  
community.rabbitmq            1.2.3  
community.routeros            2.8.2  
community.sap                 1.0.0  
community.sap_libs            1.4.1  
community.skydive             1.0.0  
community.sops                1.6.2  
community.vmware              3.7.0  
community.windows             1.13.0 
community.zabbix              2.0.1  
containers.podman             1.10.2 
cyberark.conjur               1.2.0  
cyberark.pas                  1.0.19 
dellemc.enterprise_sonic      2.2.0  
dellemc.openmanage            7.6.1  
dellemc.powerflex             1.6.0  
dellemc.unity                 1.6.0  
f5networks.f5_modules         1.25.0 
fortinet.fortimanager         2.2.0  
fortinet.fortios              2.3.0  
frr.frr                       2.0.2  
gluster.gluster               1.0.2  
google.cloud                  1.1.3  
grafana.grafana               2.0.0  
hetzner.hcloud                1.11.0 
hpe.nimble                    1.1.4  
ibm.qradar                    2.1.0  
ibm.spectrum_virtualize       1.12.0 
infinidat.infinibox           1.3.12 
infoblox.nios_modules         1.5.0  
inspur.ispim                  1.3.0  
inspur.sm                     2.3.0  
junipernetworks.junos         5.1.0  
kubernetes.core               2.4.0  
lowlydba.sqlserver            2.0.0  
microsoft.ad                  1.2.0  
netapp.aws                    21.7.0 
netapp.azure                  21.10.0
netapp.cloudmanager           21.22.0
netapp.elementsw              21.7.0 
netapp.ontap                  22.7.0 
netapp.storagegrid            21.11.1
netapp.um_info                21.8.0 
netapp_eseries.santricity     1.4.0  
netbox.netbox                 3.13.0 
ngine_io.cloudstack           2.3.0  
ngine_io.exoscale             1.0.0  
ngine_io.vultr                1.1.3  
openstack.cloud               2.1.0  
openvswitch.openvswitch       2.1.1  
ovirt.ovirt                   3.1.2  
purestorage.flasharray        1.19.1 
purestorage.flashblade        1.11.0 
purestorage.fusion            1.5.0  
sensu.sensu_go                1.13.2 
servicenow.servicenow         1.0.6  
splunk.es                     2.1.0  
t_systems_mms.icinga_director 1.33.1 
theforeman.foreman            3.11.0 
vmware.vmware_rest            2.3.1  
vultr.cloud                   1.8.0  
vyos.vyos                     4.1.0  
wti.remote                    1.0.5  
root@vijay-virtual-machine://etc/ansible# 
CONFIGURATION
root@vijay-virtual-machine://etc/ansible# ansible-config dump
[WARNING]: Ansible is being run in a world writable directory (/etc/ansible), ignoring it as an
ansible.cfg source. For more information see
https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir
[DEPRECATION WARNING]: DEFAULT_GATHER_SUBSET option, the module_defaults keyword is a more generic 
version and can apply to all calls to the M(ansible.builtin.gather_facts) or 
M(ansible.builtin.setup) actions, use module_defaults instead. This feature will be removed from 
ansible-core in version 2.18. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.
ACTION_WARNINGS(default) = True
AGNOSTIC_BECOME_PROMPT(default) = True
ANSIBLE_CONNECTION_PATH(default) = None
ANSIBLE_COW_ACCEPTLIST(default) = ['bud-frogs', 'bunny', 'cheese', 'daemon', 'default', 'dragon', 'e>
ANSIBLE_COW_PATH(default) = None
ANSIBLE_COW_SELECTION(default) = default
ANSIBLE_FORCE_COLOR(default) = False
ANSIBLE_HOME(default) = /root/.ansible
ANSIBLE_NOCOLOR(default) = False
ANSIBLE_NOCOWS(default) = False
ANSIBLE_PIPELINING(default) = False
ANY_ERRORS_FATAL(default) = False
BECOME_ALLOW_SAME_USER(default) = False
BECOME_PASSWORD_FILE(default) = None
BECOME_PLUGIN_PATH(default) = ['/root/.ansible/plugins/become', '/usr/share/ansible/plugins/become']
CACHE_PLUGIN(default) = memory
CACHE_PLUGIN_CONNECTION(default) = None
CACHE_PLUGIN_PREFIX(default) = ansible_facts
CACHE_PLUGIN_TIMEOUT(default) = 86400
CALLBACKS_ENABLED(default) = []
COLLECTIONS_ON_ANSIBLE_VERSION_MISMATCH(default) = warning
COLLECTIONS_PATHS(env: ANSIBLE_COLLECTIONS_PATHS) = ['/usr/local/lib/python3.10/dist-packages/ansibl>
COLLECTIONS_SCAN_SYS_PATH(default) = True
:
OS / ENVIRONMENT
STEPS TO REPRODUCE
- name: Configure class-map command
  hosts: cisco_ios_devices
  gather_facts: no
  connection: network_cli

  tasks:
    - name: Enter configuration mode
      ios_command:
        commands:
          - command: "class-map type control subscriber match-all DOT1X_FAILED"
            prompt: "Do you wish to continue?"
            answer: "yes"

inventory.yml file
=============
all:
  children:
    cisco_ios_devices:
      hosts:
        CSRR1:

      vars:
        ansible_user: admin
        ansible_password: cisco
        ansible_network_os: ios

ansible.cfg file
============

# Since Ansible 2.12 (core):
# To generate an example config file (a "disabled" one with all default settings, commented out):
#               $ ansible-config init --disabled > ansible.cfg
#
# Also you can now have a more complete file by including existing plugins:
# ansible-config init --disabled -t all > ansible.cfg

# For previous versions of Ansible you can check for examples in the 'stable' branches of each version
# Note that this file was always incomplete  and lagging changes to configuration settings

# for example, for 2.9: https://github.com/ansible/ansible/blob/stable-2.9/examples/ansible.cfg

[defaults]
host_key_checking = False
inventory = inventorya4.yml
gather_subset = !hardware
timeout = 60
collections_paths = /usr/local/lib/python3.10/dist-packages/ansible_collections
EXPECTED RESULTS

I expect to configure this command in my CSR1000V router "class-map type control subscriber match-all DOT1X_FAILED"

ACTUAL RESULTS
root@vijay-virtual-machine:/etc/ansible# ansible-playbook -i inventorya4.yml promptnew.yml 
[WARNING]: Ansible is being run in a world writable directory (/etc/ansible), ignoring it as an ansible.cfg source. For more information see
https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir
[DEPRECATION WARNING]: DEFAULT_GATHER_SUBSET option, the module_defaults keyword is a more generic version and can apply to all calls to the 
M(ansible.builtin.gather_facts) or M(ansible.builtin.setup) actions, use module_defaults instead. This feature will be removed from ansible-core in version 
2.18. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

PLAY [Configure class-map command] ****************************************************************************************************************************

TASK [Enter configuration mode] *******************************************************************************************************************************
fatal: [CSRR1]: FAILED! => {"changed": false, "msg": "class-map type control subscriber match-all DOT1X_FAILED\r\nclass-map type control subscriber match-all DOT1X_FAILED\r\n  ^\r\n% Invalid input detected at '^' marker.\r\n\r\nCSRR1#"}

PLAY RECAP ****************************************************************************************************************************************************
CSRR1                      : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

root@vijay-virtual-machine:/etc/ansible# 
KB-perByte commented 1 year ago

Hello @vjs-tec The command being used is a configuration command, I see the need for prompt we may supply the configuration terminal command from the command module itself.

- name: Configure class-map command
  hosts: ios
  gather_facts: no
  connection: network_cli

  tasks:
    - name: Enter configuration mode
      cisco.ios.ios_command:
        commands:
          - command: "configure terminal"
          - command: "class-map type control subscriber match-all DOT1X_FAILED"
            prompt: "Do you wish to continue?"
            answer: "yes"

Regards