Create a playbook for pre-patching notification email

90 views
Skip to first unread message

Anirban Das

unread,
Jun 14, 2022, 11:27:15 PM6/14/22
to Ansible Project
Hi Team,

I need a help to create a playbook for pre-patching notification email. I have given sample set of info which should be in subject line. Also, to,cc would be changeable according to App Name.

Can anyone pls guide how to set up all those things

Subject Line: CHG No - {{ Asset Name }} {{ App Name }} {{Environment }} OS patching on Linux Servers - {{ month }} 2022

Body:

Hi All,
We are planning to perform the patching on {{App name }} {{ Environment }} Linux Servers  in the below mentioned window. This is just a head’s up mail. We will send the notification mail  one day prior to patching.

Scheduled  window:  (10th June 2022 <Time TZ> to 10th June 2022 <Time TZ>).

Regards,

Ani


Hugo F. Gonzalez

unread,
Jun 15, 2022, 2:04:08 AM6/15/22
to ansible...@googlegroups.com
On Tue, Jun 14, 2022 at 10:27 PM Anirban Das <dasanir...@gmail.com> wrote:
I need a help to create a playbook for pre-patching notification email. I have given sample set of info which should be in subject line. Also, to,cc would be changeable according to App Name.

Can anyone pls guide how to set up all those things
 
Take a look at  https://docs.ansible.com/ansible/latest/collections/community/general/mail_module.html community.general.mail. It's 2022, so you shouldn't just try email from localhost, but get a proper mail server and authenticate. There's resources out there on how to integrate a gmail server.

As far as templating goes, either bring in a template with "{{ lookup('template', 'mytemplate.yml' }}" or simple inline templating will do for the body and subject.

Hugo F. Gonzalez

Automation Architect, Solutions & Technology Practices LATAM

Red Hat Services 

hgon...@redhat.com   
M: +52-5531490291    






--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b5a67053-01f7-4044-998a-63bbc0f675c8n%40googlegroups.com.

David Logan

unread,
Jun 15, 2022, 10:33:00 AM6/15/22
to Ansible Project
I have used https://docs.ansible.com/ansible/latest/collections/community/general/mail_module.html which is part of the community collection. It works well. I use it for mailing at the end of provisioning runs and also for patching mails.

Regards
David

--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b5a67053-01f7-4044-998a-63bbc0f675c8n%40googlegroups.com.


--
if in trouble, or in doubt
run in circles, scream and shout
Reply all
Reply to author
Forward
0 new messages