[Playbook]
---
- hosts: all
  connection: local
  gather_facts: no
  
  tasks:

    - name: Take infos
      ios_command :
        host: "{{ ansible_host}}"
        username: xxxxx
        password: xxxxxx
        timeout: xxxx
        commands:  
          - show version
          - exit
      register: result
 
    - name: get output
      copy:
        content: "{{ result.stdout_lines[0] | join('\n') }}"
        dest: "resultat/{{ ansible_host }}.txt"

   - name: check version
     shell: ./verif.sh


[output]
Cisco Identity Services Engine Patch 
---------------------------------------------
Version      : xxxx
Install Date : xxxxxxxxx

Cisco Identity Services Engine Patch 
---------------------------------------------
Version      : xxxxxxxx
Install Date : xxxxxxx


verif.sh: 


grep 'Version      : x' resultat/$1.txt 

if [ "$?" = "0" ]
then 
        echo "$1 --> OK" >> resultat/resultat.txt 
else 
        echo "$1 --> KO" >> resultat/resultat.txt
fi

Actually I just want to check that the line Version 5 for example exists in 
my.txt file without going through a script. And by the way it's a CISCO ISE

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/37a749d7-f6bf-41eb-afc1-a7937604669c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to