Hi,
when I use regex_search in my playbook, then I get this error message:

#TASK [Output to file] 
**********************************************************                      
                      

#fatal: [R34-N5696Q-1]: FAILED! => {"msg": "Unexpected templating type 
error occurred on ({{ out.std                              
#regex_search('100') #}}): expected string or 
buffer"}...ignoring                                                             
  

                                                                                
                                                                                
                                                                

   
- name: "Read Sub-Config"
  nxos_command:
    provider:
      timeout: 20
    commands:
      - "{{ c }}{{ subName }}"
  register: out

- name: "Output to file"
  no_log: false
  vars:
    outsql: "{{ out | b64encode 
}}"                                                                             
               

    cCmdsql: "{{ c }}{{ subName 
}}"                                                                             
              

    sqlRecord: "{{ s }}-{{ subName | regex_replace('interface 
','',ignorecase=True) }},{{ s }},"                               
*    sqlVLAN: "{{ out.stdout | regex_search('100') }}"   *                      
                                                

  
lineinfile:                                                                     
                                            

    path: '{{ p 
}}'                                                                             
                              

    line: '{{sqlRecord}}{{ sqlVLAN 
}}'                                                                             
           

    create: 
no                                                                              
                                  

  ignore_errors: 
true                                                                            
                             

                                                                                
                                               

When change "regex_search('100') to regex_replace('100','9999'), that works 
fine.                                             
sqlVLAN: "{{ out.stdout | regex_search('100') 
}}"                                                                             
 

('100' ist a excample, late I will search a number with 
'\d+')                                                                
                                                                                
                                                          

What is my problem? Can you help me?  
Klemens

-- 
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/114eee3b-d3e8-4dc9-8841-784fb1e49126%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to