-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to respond to interactive prompt command #769
Comments
@colinet Is the target device Cisco MDS? |
Yes, it is for an MDS switch. I've tried different syntaxes. But no way. I wonder whether the example exposed in the documentation https://docs.ansible.com/ansible/latest/collections/cisco/nxos/nxos_command_module.html is valid. |
@colinet As mentioned in the @srbharadwaj Would you be able to look into this? |
@NilashishC is the option 'prompt' a valid one? i don't see that is the documentation.. and i also see that commented out in the code cisco.nxos/plugins/modules/nxos_command.py Line 176 in 1fd405b
|
@srbharadwaj The https://github.com/ansible-collections/cisco.nxos/blob/main/plugins/cliconf/nxos.py#L240-L248 |
@colinet Could you please share the device interaction logs for this scenario? |
ok can we know where this was tested?
…On Mon, 9 Oct 2023 at 13:15, Nilashish Chakraborty ***@***.***> wrote:
@srbharadwaj <https://github.com/srbharadwaj> The prompt option is valid.
Since commands can be at least two forms - (a) a list of strings
(commands to send), (b) a list of dictionary (command + prompt + answer
combination), it's element type is set to raw in argspec. The prompt
handling logic is implemented in the cliconf plugin and in the network_cli
connection plugin code.
https://github.com/ansible-collections/cisco.nxos/blob/main/plugins/cliconf/nxos.py#L240-L248
https://github.com/ansible-collections/ansible.netcommon/blob/main/plugins/connection/network_cli.py#L1059
—
Reply to this email directly, view it on GitHub
<#769 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACXMEFJ4OG7XZBQ3Q5TU5A3X6OTTJAVCNFSM6AAAAAA5VZAMZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJSGQ4TKMJZGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@srbharadwaj The following task is tested to be working with Nexus 9300v (NX-OS 9.3.6): - name: Switch to maintenance mode
cisco.nxos.nxos_command:
commands:
- configure terminal
- command: system mode maintenance
prompt: Do you want to continue
answer: y |
@colinet You can temporarily turn off cli confirmation prompts before you run the - name: switch_fc | helpers | session_reset - perform reset
cisco.nxos.nxos_command:
commands:
- terminal dont-ask
- clear zone lock vsan 1014 |
The solution works on one fabric but surprisingly failed on second fabric with unexpected result: The playbook is now:
The outcome is:
So it tells me on second fabric that VSAN 2014 is not active which is wrong. |
Hi Remi, can you check the accounting logs when the failure occurred?
…On Mon, 9 Oct 2023 at 20:31, Remi Colinet ***@***.***> wrote:
The solution works on one fabric but surprisingly failed on second fabric
with unexpected result:
TASK [ds-role-san_CRUD : switch_fc | helpers | session_reset - perform reset] *********************************************************************************************************************************************************************************
Monday 09 October 2023 16:58:10 +0200 (0:00:00.055) 0:00:02.221 ********
ok: [localhost] => (item={'name': 'fabric_a', 'switch_fabric': 'swich_001', 'vsan_id': 1014})
failed: [localhost] (item={'name': 'fabric_b', 'switch_fabric': 'swich_002', 'vsan_id': 2014}) => {"ansible_loop_var": "fab", "changed": false, "fab": {"name": "fabric_b", "switch_fabric": "swich_002", "vsan_id": 2014}, "module_stderr": "clear zone lock vsan 2014: CLI execution error: Command will clear lock from the entire fabric only if issued on initiating switch.\nElse lock will be cleared only locally.\nVSAN 2014 is not active\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error"}
So it tells me on second fabric that VSAN 2014 is not active which is
wrong.
If I run the command directly on the switch of the second fabric, it is
successfull.
—
Reply to this email directly, view it on GitHub
<#769 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACXMEFM22ZV6FGSO532STVLX6QGU5AVCNFSM6AAAAAA5VZAMZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJTGE3TSNBUGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@colinet Just for my understanding, which connection type are you using to run the original task with the prompt and answer? |
I'am getting the following accounting log just after having run the playbook on the 1st switch of the second fabric:
|
I'am using API connexion type. |
I run the playbook with -vvv.
The message 'VSAN 2014 is not active' on the second fabric is unrelated to current action, and unexpected. When I run the command ""clear zone lock vsan 2014" manually on the switch mhxcissan001sas, I get:
'VSAN 2014 is not active' should not show up when executing the command via the API and Ansible. |
I don't think prompts will ever work with NX-API due to the very nature of HTTP. Have you tried doing the same thing via the NX-API sandbox? Does it work there? |
I'am fine with '- terminal dont-ask' 1st command (and forget about prompt through NX-API). |
On fabric B where the error related to VSAN 2014 not being active, the state is :
|
@colinet does the accounting log on |
SUMMARY
While running below playbook, it fails :
The text was updated successfully, but these errors were encountered: