sending host task info to an email

18 views
Skip to first unread message

Angie DeRubeis

unread,
Sep 8, 2020, 6:30:11 PM9/8/20
to Ansible Project
Hello, 

I have a cisco ios command configured for a group of host and a mail setup to send results but the results mail separately instead in group, as the task does.  How do I change it to send one email per playbook?   

Antony Stone

unread,
Sep 8, 2020, 6:39:22 PM9/8/20
to ansible...@googlegroups.com
It might help us to be able to answer your question if you gave us a bit more
information such as:

- what is the "command you have configured for the group of host(s)"?

- what is the "mail setup" you're using?

- how have you built this in to the playbook to send an email?

Tell us enough to reproduce your setup and your problem, and we might be able
to work out how to help you :)


Regards,


Antony.

--
I love deadlines. I love the whooshing noise they make as they go by.

- Douglas Noel Adams

Please reply to the list;
please *don't* CC me.

Angie DeRubeis

unread,
Sep 8, 2020, 6:55:33 PM9/8/20
to ansible...@googlegroups.com
I am getting the output from the task and I am getting a separate email with the task but it is not inserting the hostname. 

I would like to see the hostnames and one email per playbook. 

This is my playbook 

-name: Verify NAC 
 host: switches
connection: local 

task: 

ios_command:
   commands: show authentication sessions 
register: output 

-name: show authentication sessions 
 debug: var=output.stdout[0]

-name: send email 
 mail: 
      host: mail.company.com
      timeout:60 
      subject: NAC verification {{output.stdout[0}
      from: mygroup#mygroup.com
      to: m...@mygroup.com 

 
Reply all
Reply to author
Forward
0 new messages