Yes please raise a Github issue.
 Based on code eric_eccli_commnad module should support prompt when the
value of “commands” option is list of dictionary. What is the error you see
with eric_eccli_command module.


On Fri, 16 Aug 2019 at 2:01 PM, Lucas Möller <lucas.moelle...@gmail.com>
wrote:

> Ok I have now checked the python code and commented the argument newline
> out (lib/ansible/modules/network/cli/cli_command.py: Line 147).
>
> It is seems to work now.
> But there is then an issue with the newline parameter on the type of
> network devices.
>
> If anybody does not have a better solution or any information I might
> still be missing, I will open a feature request for prompts in eric_eccli
> and a bug report for cli_command and the newline parameter.
>
> Thank you
>
>
> On Friday, August 16, 2019 at 9:51:28 AM UTC+2, Lucas Möller wrote:
>>
>> Thank you for the information.
>> eric_eccli_command has actually no option for prompts.
>> cli_command is then the way to go but there is another issue with that,
>> which seems not to be related to the input in the playbook, but the output
>> from the device:
>>
>>     "changed": false,
>>     "invocation": {
>>         "module_args": {
>>             "answer": [
>>                 "y"
>>             ],
>>             "check_all": false,
>>             "command": "save configuration",
>>             "newline": false,
>>             "prompt": [
>>                 "Target file exists, overwrite? (y/n)"
>>             ],
>>             "sendonly": false
>>         }
>>     },
>>     "msg": "get() got an unexpected keyword argument 'newline'"
>>
>> It does not matter what I enter as prompt and answer.
>> The actual response for the prompt from the device are two lines of
>> output and in the second line the prompt has to be answered
>>
>> Save to file: /flash/device_config.cfg
>> Target file exists, overwrite? (y/n) <answer should be here>
>>
>> Though what I understand is that the error is not from the playbook
>> syntax but from the parsing of the response.
>> Is there any option to avoid that error? Or to loop over the lines and
>> answer on a match?
>>
>> On Friday, August 16, 2019 at 8:09:31 AM UTC+2, Ganesh Nalawade wrote:
>>>
>>>
>>> Try with below task. The prompt option is a regex value to match the
>>> expected terminal prompt after executing the command.
>>>
>>> - name: save configuration to flash memory
>>>   eric_eccli_command:
>>>     commands:
>>>       - command: save configuration
>>>         prompt: <regex to match prompt on terminal after command execution>
>>>         answer: 'y'
>>>
>>> OR
>>>
>>> - name: save configuration to flash memory
>>>   cli_command:
>>>     command: save configuration
>>>     prompt: <regex to match prompt on terminal after command execution>
>>>
>>>     answer: 'y'
>>>
>>>
>>> https://docs.ansible.com/ansible/latest/modules/cli_command_module.html
>>>
>>>
>>>
>>> On Thursday, 15 August 2019 15:12:01 UTC+5:30, Lucas Möller wrote:
>>>>
>>>> Hi all,
>>>>
>>>> I am currently developing and checking out the eric_eccli module which
>>>> has been merged to the devel build not long ago.
>>>> I am using the newest Ansible devel build
>>>>
>>>> I got now a failure of a task with, as it seems, a normal command:
>>>>
>>>> - name: save configuration to flash memory
>>>> eric_eccli_command:
>>>> commands:
>>>> - save configuration
>>>>
>>>> even with
>>>> - y
>>>> or wait_for it fails due to command timeout.
>>>>
>>>> From the terminal point of view it asks if the existing file should be
>>>> overwritten.
>>>>
>>>> On playbook execution, it fires the command waits until the timeout and
>>>> fails.
>>>> Other commands work just fine, to mention all other commands do not
>>>> require user input for (y/n).
>>>>
>>>> This is a crucial feature for automating the upgrade and configuration
>>>> management of the devices
>>>> Also the release download command for the device requests user input of
>>>> (y/n)
>>>>
>>>> Shell, command and raw modules do not solve the issue either.
>>>>
>>>> Currently I see no way around this. Shall I report it as a bug on
>>>> GitHub?
>>>> Or am I missing something?
>>>> It seems like the module is not capable of reacting to user input
>>>> actions like (y/n)
>>>>
>>>> To note: It fails on different devices due to the same issue.
>>>>
>>>> Feedback is appreciated.
>>>>
>>>> //Lucas
>>>>
>>>> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-devel/ca340d71-f319-473f-ad05-8f29af8ed992%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-devel/ca340d71-f319-473f-ad05-8f29af8ed992%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
-- 
Regards,
Ganesh B. Nalawade
Principal Engineer
Ansible by Red Hat
irc: ganeshrn

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/CA%2B6y2sGz7jhEz1qEjfB-esXyNCVTKLSETKQmuSBDN1AzU5syVA%40mail.gmail.com.

Reply via email to