Ansible ios_command prompt issue
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
el 04-25-2024 10:18 AM
Hello everyone
I'm writting you because I'm actually having a problem with the prompt using ios_command in Ansible.
So, I'm sending a command to copy a file from a FTP server. The prompt will ask to confirm the file name, so I'm sending '\r' as the answer, as a carriage return. Everything works fine with many devices, but then a new file comes into play, and the file has a name similar to this: cModelx-universalk9.version.bin
My task looks like this:
- name: FTP Transfer
ios_command:
commands:
- command: 'copy ftp://server/path/filename'
prompt: '[ {{ filename }} ]'
answer: "\r"
I keep the file name in the variable called filename. So, I'm receiving the following error in the console:
Failed to compile one or more terminal prompt regexes: bad character range x-u at position 7
What's happening here is that the prompt is reading the filename string as if I were using regex, so it's treating that part of the name where you have the x-u as if I'm trying to tell "Hey! check for characters among the x and u letters!" ... of course, it won't work since x comes after the u letter. It's not failing with other file names. I have a file that has a-x in the string, and it's not failing.
I understand that I can change the file name and fix the issue, but it's not so simple, I don't have the possibility to rename the file.
That Ansible task is being used for other models, so I would prefer not to change it. I'm trying to find a way to tell Ansible to read the string as a plain text and ignore character combinations. I couldn't find anything on the documentation.
Do you know if is there any parameter I can use?
Thanks in advance
- Etiquetas:
-
ansible
-
ios_command
-
prompt
