Thanks, issue resolved

On Wednesday, June 10, 2020 at 10:17:30 AM UTC+5:30, Ompragash wrote:
>
> 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
>
> On Wed, 10 Jun 2020 at 09:36, Mohanraj B <[email protected] <javascript:>> 
> wrote:
>
>> 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
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/549a7eca-74f9-4a52-80cc-e70dcc7e42dao%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/549a7eca-74f9-4a52-80cc-e70dcc7e42dao%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/36688341-deb1-4ca2-a4c6-08401aad62d9o%40googlegroups.com.

Reply via email to