We are always trying to lower the barrier to entry when it comes to monitoring and observability and one place we have consistently witnessed some pain from users is around adopting and approaching configuration management tools and practices as your infrastructure grows and becomes more complex.
This post introduces this project as a somewhat simple example of using Ansible with Netdata. Read on to learn more, but more importantly feel free to explore the repo and see how it all hangs together.
If you are not that familiar with Ansible, the official getting started tutorial is a great place to start. Some of the main concepts, "inventory", "task", "playbook", map fairly direclty onto the project structure below.
Like any great tool there is a lot of flexibility and different ways to achieve your goals. For our user case here, managing a handful of somewhat homogenous servers that make up the ML demo room, the below general structure has worked fine so far for us.
host_vars- some yaml files for host specific variables live in here.
playbooks- various playbooks (collections of tasks) for common maintenance and configuration management activities.
tasks- yaml files defining low level tasks, related tasks group in folders (e.g. Netdata tasks live in
templates- templated files, typically configuration files live in here (all use Jinja2).
vars- different variable files for each system or component live in here. Used by templates and tasks.
inventory.yaml- A list of all the hosts managed by this Ansible project as well as one or two global default variables.
Thats pretty much all there is to it. The best way to get started really is to have a look at some examples of tasks (for example this task to define some ML based alerts) and playbooks (for example restart Netdata and check its status before and after) and then start simple and adapt them to your needs.
Below are some useful links and resources for both users new to configuration management and those looking to do more advanced tasks and complex specific Netdata related use-cases.
- Official Ansible getting started tutorial
- A collection of different configuration management resources from the
netdata/ansiblerepo with some more complex Netdata configuration tasks.
- A great playlist of Ansible videos from our friends at learnlinux.tv.
- A nice blog post from Atlassian on configuration management in general and some of the tools.