Posts

Showing posts from June, 2018

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...

Nginx deployed through Terraform and Ansible

nginx deployed through terraform and ansible Purpose This Terraform deployment will set up a floating IP, 2 nodes with Nginx configures as load balancers, and 2 web nodes. Provisioning will be handled by Terraform and configuration will be done with Ansible. The repo used can be located here . Prerequisites You’ll need to install Terraform which will be used to handle Droplet provisioning. In order to apply configuration changes to the newly provisioned Droplets, Ansible needs to be installed. Ansible’s inventory will be handled by Terraform, so you’ll need terraform-inventory . We’re going to need a DigitalOcean API key. The steps to generate a DigitalOcean API key can be found here . Use the included gen_auth_key script to generate an auth key for your load balancing cluster. Configuring Let’s get Terraform ready to deploy. We’re going to be using terraform.tfvars to store values required such as API key, project name, SSH data, the number of backe...