getting error - "Unsupported parameters for (cli_command) module"

Hello,

I getting error - “Unsupported parameters for (cli_command) module” when trying to run install activate command in cat9k device.

Below is the playbook snippet:

`

  • name: Run install activate and reload
    block:

  • name: Run install activate
    cli_command:
    commands:

  • command: ‘install activate’
    check_all: True
    prompt:

  • “Press Quit(q) to exit, you may save configuration and re-enter the command”

  • “This operation requires a reload of the system. Do you want to proceed”
    answer:

  • ‘y\r’

  • ‘y\r’
    vars:
    ansible_command_timeout: 1200

  • name: Reload device and wait for connection to establish
    wait_for:
    host: “{{ inventory_hostname }}”
    port: 22
    delay: 60
    timeout: 720

  • name: Show version
    cli_command:
    commands:

  • command: “sh version”
    `

Run the ansible-playbook with -vvv.

TASK [CAT9K-Upgrade : Run install activate] ****************************************************************************************************************************** task path: /root/ansible/imageupgrade/CAT9K-Upgrade/tasks/main.yml:7 <192.168.23.24> ESTABLISH LOCAL CONNECTION FOR USER: root <192.168.23.24> EXEC /bin/sh -c '( umask 77 && mkdir -p " echo /root/.ansible/tmp/ansible-local-164668ym091 "&& mkdir /root/.ansible/tmp/ansible-local-164668ym091/ansible-tmp-1591766752.49-16488-79665405661014 && echo ansible-tmp-1591766752.49-16488-79665405661014=" echo /root/.ansible/tmp/ansible-local-164668ym091/ansible-tmp-1591766752.49-16488-79665405661014 `" ) && sleep 0’
<192.168.23.24> Attempting python interpreter discovery
<192.168.23.24> 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’“'”‘; command -v ‘"’"’/usr/bin/python3’“'”‘; command -v ‘"’“‘python’”’"‘; echo ENDFOUND && sleep 0’
<192.168.23.24> EXEC /bin/sh -c ‘/usr/bin/python && sleep 0’
Using module file /usr/lib/python2.7/site-packages/ansible/modules/network/cli/cli_command.py
<192.168.23.24> PUT /root/.ansible/tmp/ansible-local-164668ym091/tmplDs5p1 TO /root/.ansible/tmp/ansible-local-164668ym091/ansible-tmp-1591766752.49-16488-79665405661014/AnsiballZ_cli_command.py
<192.168.23.24> EXEC /bin/sh -c ‘chmod u+x /root/.ansible/tmp/ansible-local-164668ym091/ansible-tmp-1591766752.49-16488-79665405661014/ /root/.ansible/tmp/ansible-local-164668ym091/ansible-tmp-1591766752.49-16488-79665405661014/AnsiballZ_cli_command.py && sleep 0’
<192.168.23.24> EXEC /bin/sh -c ‘/usr/bin/python /root/.ansible/tmp/ansible-local-164668ym091/ansible-tmp-1591766752.49-16488-79665405661014/AnsiballZ_cli_command.py && sleep 0’
<192.168.23.24> EXEC /bin/sh -c ‘rm -f -r /root/.ansible/tmp/ansible-local-164668ym091/ansible-tmp-1591766752.49-16488-79665405661014/ > /dev/null 2>&1 && sleep 0’
fatal: [192.168.23.24]: FAILED! => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/bin/python”
},
“changed”: false,
“invocation”: {
“module_args”: {
“commands”: [
{
“answer”: [
“y\r”,
“y\r”
],
“check_all”: true,
“command”: “install activate”,
“prompt”: [
“Press Quit(q) to exit, you may save configuration and re-enter the command”,
“This operation requires a reload of the system. Do you want to proceed”
]
}
]
}
},
“msg”: “Unsupported parameters for (cli_command) module: commands Supported parameters include: answer, check_all, command, newline, prompt, sendonly”
}

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

`

How to fix this issue?

Thanks,
Mohan

Hi Mohanraj,

As the error states, you have defined an unsupported parameter “commands” for cli_command module and your task should look something like below:

- name: run command expecting user confirmation
  cli_command:
    command: show interface summary
    prompt: Press any key to continue
    answer: y
    newline: false

Refer https://docs.ansible.com/ansible/latest/modules/cli_command_module.html

Regards,
Ompragash

Thanks, issue resolved