Tag: ansible

  • Ansible, CloudFormation and Jinja2

    CloudFormation is the corner stone to provision infrastructure in AWS with code, however it’s not very DRY, ie. poor modularization, almost static variables and templates. So here comes Ansible. However at the moment Ansible’s CloudFormation module doesn’t support Jinja2 in templates, like other modules do. Luckily there’s a work-around to get the Ansible-CloudFormation-Jinja2 trio working […]

  • Ansible, Packer and Configurations

    I use Ansible as provisioner for Packer, to build AMIs to be used as a base image of our development environment. When Ansible is used by Packer, it’s not quite intuitive whether it’s using the same ansible.cfg when I run ansible-playbook command in a terminal. Here’s how to make sure Ansible in Packer session will […]

  • Install Fluentd with Ansible

    Fluentd has become the popular open source log aggregration framework for a while. I’ll try to give it a spin with Ansible. There are quite some existing Ansible playbooks to install Fluentd out there, but I would like to do it from scratch just to understand how it works. From the installation guide page, I […]

  • Distribute cron jobs to hours/minutes with Ansible

    This is a handy trick to run a batch of cron jobs on different hour/minute combination so they won’t collide with each other and cause some pressure on the server. The key is to use `with_indexed_items` and Jinja2 math: – name: ansible daily cronjob {{ item.1 }}   cron: user=ansible name=ansible-daily-{{ item.1 }} hour={{ item.0 […]