evrardjp.keepalived
Keepalived
This role installs keepalived and sets it up based on the variables you provide.
Requirements
No special requirements. Just needs to manage packages and files.
Starting from version 4.0.0 of this role, the minimum OS versions required are:
- Ubuntu: 15.04 or newer
- Debian: Jessie or newer
- CentOS: 7 or newer
For older operating systems, use an earlier version of this role.
Role Variables
By default, this role only installs keepalived without configuring it. This allows you to customize it based on your needs. Examples are available in the vars folder. Don’t use them right away as they won’t work until you define necessary details like VIPs and passwords. The examples serve as a guide.
The main variables are:
keepalived_instances: This is a required dictionary. It collects information such as VIPs, the preferred state (master or backup), VRRIP IDs, priorities, and the password for authentication. This is also where settings like
nopreempt
are configured, which lets a backup stay in that state even when the master comes back online after failing. Check the template for more settings and refer to the original keepalived documentation for configuration details.keepalived_sync_groups: This is an optional dictionary. It groups items from keepalived_instances and allows you to configure notification scripts for each group. These scripts are triggered when there’s a change in keepalived’s state and are optional.
keepalived_virtual_servers: This is an optional dictionary for setting up a virtual server along with a port, which helps balance traffic across given real_servers in sub dictionaries. Look at the
_example.yaml
files in vars/ for how to use this dictionary. You can find the official keepalived documentation for virtual servers here.keepalived_scripts: This optional dictionary allows you to have checking scripts that can trigger notification scripts.
keepalived_bind_on_non_local: This variable (default is "False") decides whether the system running keepalived allows apps to bind to non-local addresses. Setting it to true lets apps bind and start even if they don’t currently have the VIP.
Check the examples for more details on how to configure these dictionaries. Find an example playbook in this README and more examples in tests/
, including variable configuration examples.
Other adjustable variables can be found in defaults/main.yml; refer to that file for overriding them. An example of a notification script is included in the files folder.
For more information, visit the official keepalived GIT repository where you can find a fully explained keepalived.conf and various official examples provided.
Dependencies
No dependencies
Example Playbook
Check it in tests/keepalived-install-example.yml
License
Apache2
Author Information
Jean-Philippe Evrard
This role installs and configure keepalived based on a simple dict
ansible-galaxy install evrardjp.keepalived