Configure Postfix through cloud-init
Configure Postfix through cloud-init I recently decided to set up Nagios for monitoring a small cluster of nodes I’m running, and set up alerts to be sent out through email; however, I didn’t want those emails being sent directly from the VPS itself. What I did was set up this cloud-config script to be executed in order to spin up the VPS with postfix configured to connect to a Google email account in order to send out notification emails. This should help with minimizing the possibility that the email will be seen as spam and I won’t have to add additional IP addresses to my SPF record. Here’s the script for you to try out if you’re interested in getting this set up: #cloud-config packages: - postfix - mailutils - libsasl2-2 - ca-certificates - libsasl2-modules write_files: - path: /etc/postfix/sasl_passwd content: | [smtp.gmail.com]:587 [email protected]:PASSWORD owner: root:root permissions: 0400 runcmd: - sed -i 's/r...