hifis.keepalived

<!--
SPDX-FileCopyrightText: 2022 Helmholtz Centre for Environmental Research (UFZ)
SPDX-FileCopyrightText: 2022 Helmholtz-Zentrum Dresden-Rossendorf (HZDR)

SPDX-License-Identifier: Apache-2.0
-->

# Keepalived Role

:warning: **This project is archived!** :warning:

This role has moved to our `hifis.toolkit` collection:

- <https://github.com/hifis-net/ansible-collection-toolkit>
- <https://galaxy.ansible.com/ui/repo/published/hifis/toolkit/>

[![CI Status](https://github.com/hifis-net/ansible-role-keepalived/actions/workflows/ci.yml/badge.svg)](https://github.com/hifis-net/ansible-role-keepalived/actions/workflows/ci.yml)
[![Ansible Role: hifis.keepalived](https://img.shields.io/badge/role-hifis.keepalived-blue)](https://galaxy.ansible.com/ui/standalone/roles/hifis/keepalived/)
[![Ansible Role Downloads](https://img.shields.io/ansible/role/d/hifis/keepalived)](https://galaxy.ansible.com/ui/standalone/roles/hifis/keepalived/)
[![Apache-2.0 Licensed](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/hifis-net/ansible-role-keepalived/blob/main/LICENSES/Apache-2.0.txt)
[![Latest release](https://img.shields.io/github/v/release/hifis-net/ansible-role-keepalived)](https://github.com/hifis-net/ansible-role-keepalived/releases)

This Ansible role helps you set up Keepalived for high availability and scalability.

Currently supported operating systems are:

- Ubuntu 22.04 LTS
- Ubuntu 20.04 LTS

## Requirements

None.

## Role Variables

### Required variables (must be set)

#### Keepalived peers

Set the IP addresses of the Keepalived peers:

```yaml
keepalived_unicast_peers: 
  - '192.168.33.15'
  - '192.168.33.16'

Keepalived virtual IP address

Set the virtual IP address:

keepalived_virtual_ip_address: '192.168.33.100'

Optional: Multiple virtual IP addresses

If you want to configure multiple virtual IPs, you can use this optional variable. This will override the previous virtual IP setting.

keepalived_virtual_ipaddress_configs:
  - "10.0.10.15 dev eth0"
  - "10.0.11.15 dev eth1"

Other Default Variables

Keepalived version

Set the Keepalived version:

keepalived_version: '2.2.8'

Dependencies

List of dependencies to install for Keepalived:

keepalived_dependencies:
  - 'build-essential'
  - 'curl'
  - 'gcc'
  - 'libssl-dev'
  - 'libnl-3-dev'
  - 'libnl-genl-3-dev'
  - 'libsnmp-dev'

Executable path

Path to the Keepalived executable:

keepalived_executable_path: '/usr/local/sbin/keepalived'

Download URL

Where to download Keepalived from:

keepalived_download_url: 'https://www.keepalived.org/software/keepalived-{{ keepalived_version }}.tar.gz'

Configuration template name

Name of the Keepalived config template file:

keepalived_conf_template: 'keepalived.conf.j2'

Configuration directory

Directory for Keepalived configuration files:

keepalived_conf_dir: '/etc/keepalived'

Configuration file path

Path to the Keepalived configuration file:

keepalived_conf_file_path: '/etc/keepalived/keepalived.conf'

Sysconfig file path

Path to the Keepalived sysconfig file:

keepalived_sysconfig_file_path: "/etc/keepalived/keepalived.sysconfig"

Systemd service file name

Name of the template for the Systemd service file:

keepalived_service_template: 'keepalived.service.j2'

Service file path

Path to the Keepalived service file:

keepalived_service_file_path: '/etc/systemd/system/keepalived.service'

PID file path

Path to the Keepalived PID file:

keepalived_pid_file_path: "/run/keepalived/keepalived.pid"

Notification settings

Set email for notifications:

keepalived_notification_email: 'name@localhost'

Configure sender of notifications:

keepalived_notification_email_from: 'keepalived@localhost'

SMTP server configuration:

keepalived_smtp_server: '127.0.0.1'

Instance state

Set the Keepalived instance state (MASTER or BACKUP):

keepalived_state: 'BACKUP'

Instance priority

Set the priority of the Keepalived instance:

keepalived_priority: '99'

Automatic priority management

Maximum automatic priority increase (0-99 or -1 to disable):

keepalived_max_auto_priority: '99'

Router ID

Set a unique name for the Keepalived router:

keepalived_router_id: 'KEEPALIVED_2'

Instance weight

Adjust priority by this weight:

keepalived_weight: '0'

Unicast source IP address

Set the unicast source IP address:

keepalived_unicast_src_ip: '{{ ansible_default_ipv4.address }}'

Network interface

Set the network interface for the floating IP:

keepalived_interface: "{{ ansible_default_ipv4.interface }}"

Authentication password

Set the authentication password for Keepalived:

keepalived_auth_pass: 'changeme'

Script security

Enable script security to prevent non-root scripts:

keepalived_set_script_security_flag: true

User and group for the script

Specify user and group for running the Keepalived script:

keepalived_script_user: 'haproxy'
keepalived_script_group: 'haproxy'

Process tracking

Enable tracking of a specific process:

keepalived_enable_process_tracking: true
keepalived_track_process: 'haproxy'

Script execution

Activate and specify a script to be run by Keepalived:

keepalived_activate_script: false
keepalived_script_name: 'chk_haproxy_process'
keepalived_script_command: '/usr/bin/killall -0 haproxy'

Dependencies

None.

This role is designed to work with the hifis.haproxy role.

Example Playbook

- hosts: loadbalancers
  roles:
    - role: hifis.keepalived
      vars:
        keepalived_virtual_ip_address: '192.168.33.100'
        keepalived_unicast_peers:
          - '192.168.33.15'
          - '192.168.33.16'

License

Apache-2.0

Author Information

HIFIS Software Services Team ```

Informazioni sul progetto

A role to set up Keepalived in a high availability and scalability context.

Installa
ansible-galaxy install hifis.keepalived
Licenza
other
Download
26.6k
Proprietario
Helmholtz Digital Services for Science — Collaboration made easy.