I have multiple files in a path and it contains mail id of the users. 
I need to loop the file content using with_items and filter users ID from 
the file content.
That ID's should be passed into mail module, mail needs to be sent to those 
user ID's. 

Please help me filter only ID form the file content and it needs to be 
looped into mail module.

cat /test/user1

Name: Anton
ID: [email protected]

cat /test/user2
Name: Jeniffer
ID: [email protected]

      - shell:  cat {{ item }}  | egrep -v 'provided|valid'
        register: file_content
        with_items:
          - /test/user1
          - /test/user2

      - name: Send mail notification to the user
        mail:
          host: mailrelay.xxx.com
          port: 25
          subject:  Information
          body: "{{ lookup('file', '{{  req_path  }}/{{ req }}') + 
lookup('file', '{{ mail_sign  }}') }}"
          from: [email protected]
          to: [email protected]
          charset:  utf8
        run_once: true


-- 
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/de2cf98d-b373-4d94-8f97-0daf4e47b5aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to