Create a playbook for pre-patching notification email

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 to 10th June 2022 ).

Regards,

Ani

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

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.