Score:0

Ansible module for Brocade/ICX is misbehaving

ng flag

I've to perform some network automation in my infra using ansible.

When i'm trying to use ansible module for icx switches it seems to be misbehaving.

Playbook i used

- name: ICX switch testing
  hosts: test-switch
  gather_facts: no
  vars:
    ansible_user: username
    ansible_password: password
    ansible_connection=ansible.netcommon.network_cli
    ansible_network_os=icx
  tasks:
    - name: show version
      icx_command:
        commands:
          - show version

for this i'm getting below error

FAILED! => {"changed": false, "msg": "skip\r\nInvalid input -> skip\r\nType ? for a list\r\nSSH@ICX7250-24P Switch>"}

when I use enable mode using ansible_become then it gives below error

FAILED! => {"changed": false, "msg": "unable to elevate privilege to enable mode, at prompt [None] with error: timeout value 60 seconds reached while trying to send command: b'enable'"}

i'm not sure why command enable changed to b'enable. Seems some issue with module

ansible version

ansible 2.9.9
  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.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.8 (default, Sep 26 2019, 11:57:09) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Score:0
is flag

Regarding this specific error:

Invalid input -> skip\r\nType ? for a list

You may have to modify the actual icx_config.py module.

On Macs, for example, it's located here:

/usr/local/Cellar/ansible/6.4.0/libexec/lib/python3.10/site-packages/ansible_collections/community/network/plugins/modules/network/icx/icx_config.py

The line you must modify is, potentially, 364:

run_commands(module, 'skip')

Comment it out and try again.

#run_commands(module, 'skip')

It took me many days to sort this out after googling with no avail, so maybe it helps someone in the future.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.