Tag: ansible

  • Event-Driven Ansible with Zabbix

    Zabbix supports Event-Driven Ansible. This makes it possible to launch job_templates in Ansible Automation Platform based on triggers in Zabbix. One use case is to update host events in Zabbix with facts from Ansible, which we will take a look at in this post. Ansible Automation Platform You will need various credentials, a decision environment…

  • Gitlab CI/CD for Ansible inventory

    The inventory is your source of truth in Ansible. It contains all your hosts along with data about your hosts. The data from the inventory represents the desired state you want to reach with Ansible and is used to overwrite arguments (defaults) in roles and playbooks. You can build your inventory statically, using dynamic inventory…

  • Ansible directory structure for efficient work

    There is a lot of ways you can structure your playbooks, inventory, roles, and collections in Ansible, but it’s beneficial to find a structure that is suitable for both development and AWX/AAP. This is what my layout looks like: I have a Git repository called playbooks that contains all my playbooks. Symbolic links point to…

  • Installing Ansible correctly

    The Ansible controller requires a UNIX-based OS and Python. Since Ansible runs in Python, it can (and should) be installed through pip – the package manager for Python. The optimal way to manage Python packages is by first creating and enabling a virtual environment; a disposable and OS-isolated environment locked to a specific Python interpreter.…

  • Ansible inventory structure

    The inventory is Ansible’s source of truth. It is where all your hosts and groups, along with data like NTP and VLANs, are defined. Building and maintaining an inventory for Ansible can be difficult, but less so if you get the structure right. I define my groups and hosts in a (ini) file named groups_and_hosts.…

  • Ansible loop speed to the max

    Imagen you want to use Ansible to set interface description based on CDP. The following example is super slow because each iteration in the loop, that satisfies the condition, is a separate task that Ansible has to execute. Modern modules, so-called resource modules, start with a “config” option that accepts multiple items from a list.…

  • Cisco Catalyst slow SCP fix

    Cisco released the following command in IOS-XE 17.2.6. This essentially increases the window-size for SCP which allows for more throughput – and it is very noticeable: an IOS-XE image is around 1.2 GB, and this new command makes SCP go from hours to minutes. Here is an Ansible example showing how to utilize this new…

  • Ansible persistent logging

    By default, Ansible logs the output of playbooks to stdout. This is all fun and games until you close the terminal, something breaks, your logs are gone and you (like me) don’t remember exactly what you did. Luckily, persistent logging can easily be configured on the Ansible controller. These logs do not give you the…