Ansible role + modules for HAProxy management through API

Started by mj84, August 14, 2019, 12:06:28 AM

Previous topic - Next topic
Hi folks,

I have started using OPNsense a few months ago and I'm quite impressed by almost every aspect of the product so far!
My OPNsense cluster is mainly serving as a Reverse Proxy / Loadbalancer using the HAProxy module, so I wanted to search for a way for easier configuration management.

As I am a heavy user of Ansible, I have started developing Ansible modules and a corresponding Ansible role definition for managing OPNsense's HAProxy configuration more easily.
My goal is for this project to be feature-complete, so every aspect of HAProxy on OPNsense shall be reflected in these Ansible modules.

For now, the following OPNsense HAProxy object types can be managed:

  • ACLs (Conditions)
  • Actions (Rules)
  • Errorfiles (Error Messages)
  • Groups
  • LUA services
  • Maps (Map Files)
  • Servers
  • Users

These datatypes are still to come:

  • Backend Pools
  • CPUs (CPU Affinity Rules)
  • Frontends (Public Services)
  • Healthchecks (Health Monitors)

I have created a GitHub repo for this project here: https://github.com/mj84/ansible-opnsense-haproxy

Any questions or input are very welcome :)

Please note that this is still under heavy development, and there is quite a bit of refactoring to be done, so variable names etc. will change for sure.

I will try to keep this post updated as I implement the remaining datatypes and update the documentation.

Cheers,
Markus

I just moved the changelog to the first reply for better overview.

Changelog:

  • 2019-08-14: Initial post
  • 2019-08-14: Servers can now be managed
  • 2019-08-14: Lua scripts can now be managed
  • 2019-08-15: Groups and Mapfiles can now be managed

Can a mod please move this topic in the "Development and Code Review" sub-forum?
Thanks!