My ansible roles
Posted in automation on July 23, 2020 by Adrian Wyssmann ‐ 2 min read
In meanwhile I got some experiences in writing roles and yesterday I finally finished my 3rd role - for me this is much considering my spare time left after work and family.
I use Ansible since a long for setting up my infrastructure. I find it quite cool and very simple to use. One of the feature of Ansible are roles:
Roles are ways of automatically loading certain vars_files, tasks, and handlers based on a known file structure. Grouping content by roles also allows easy sharing of roles with other users.
Roles follow a certain structure as you can read in the docu. Finally you can find all available roles in ansible-galaxy. My first role was ansible-role-rsyslog. I am using an external logging service to store the logs of my servers. Initially I tried loggly.com but finally ended up with logz.io which is very nice and offers a free tier for up to 3GB per day with 3 days of retention. Quite enough for my private stuff. So both of these services offer the consumption of
rsyslogs. Thus, I needed an automated way to configure my servers to securly forward the logs.
The second role was ansible-role-borg. For my personal machine I use borg to backup my data to a locally attached disk plus to a dedicated cloud location. Borg is quite cool but in order to make the backup regurarly you have to create a script and run it regurarly. So I came up with the ansible role which does this all for me.
The last one was ansible-role-cloudflared. Cloudflare is a very cool company and offers quite fancy stuff. I started to use Argo Tunnel
Cloudflare’s lightweight Argo Tunnel daemon creates an encrypted tunnel between your origin web server and Cloudflare’s nearest data center — all without opening any public inbound ports.
This is a great way to secure your infrastructure and it’s definitively something I wanted to use. Again, I needed a nice way to automatically setup my servers. The mentioned role is the end-result.
I you like them and want to use them, do so but please leave me a rating at Ansible Galaxy I really would appreciate it.