uZer.keepalived

ansible-role-keepalived

Statut de construction

Ce rôle installe keepalived à partir d'un dépôt apt/yum. Peut configurer plusieurs vérifications de service et plusieurs VIP.

Toutes les variables doivent être configurées dans host_vars ou group_vars.

Dépendances

Doit fonctionner sur Centos, Redhat, Ubuntu, Debian.

Exemple d'utilisation complet

  • Variables d'hôte (doivent être définies dans host_vars/...):
keepalived_role:
  "VI_1": "MASTER"              # Peut être MASTER ou SLAVE
  "VI_2": "MASTER"
  "VI_3": "SLAVE"
  • Variables de groupe (doivent être définies dans group_vars/... par pod keepalived):
keepalived_vrrp_instances:
  "VI_1":
    virtual_router_id: 51       # Servira d'étiquette pour l'interface
    master_priority: 100         # Priorité. Plus c'est grand, mieux c'est
    slave_priority: 50
    shared_iface: eth0
    shared_vips:
      - '10.127.50.3'
    auth_pass: "{{ vault_vrrp_passwords["VI_1"] }}"

  "VI_2":
    virtual_router_id: 52
    master_priority: 100
    slave_priority: 50
    shared_iface: eth0
    shared_vips:
      - '10.127.50.4'
    auth_pass: "{{ vault_vrrp_passwords["VI_2"] }}"

  "VI_3":
    virtual_router_id: 53
    master_priority: 100
    slave_priority: 50
    shared_iface: eth0
    shared_vips:
      - '10.127.50.5'
    auth_pass: "{{ vault_vrrp_passwords["VI_3"] }}"
    checks:
      - chk_nginx
      - chk_keepalived
    settings:
      garp_master_refresh: 20

keepalived_checks:
  "chk_nginx":
    process: nginx              # Surveille NGINX en utilisant `killall -0`
    period: 2                   # toutes les 2 secondes
  "chk_keepalived":
    script: pgrep keepalived    # Surveille Keepalived
    period: 2                   # toutes les 2 secondes

# Dans le coffre (vault):
vault_keepalived_vrrp_passwords:
    "VI_1": 'YUiszRrpLEXbnMLqDapwWLvPAJ'
    "VI_2": 'rJEUkQnmSRahwRTpjUkFVid'
    "VI_3": 'itkcbxmaXwFBiUZJhePmtX'

# OPTIONNEL POUR NOTIFICATION ET RÉGLAGE
keepalived_advert_interval: 1
keepalived_notify_from: "keepalived@{{ ansible_fqdn }}"
keepalived_notify_smtp_server: "smtp.example.com"
keepalived_notify_smtp_timeout: "30"
keepalived_notify_list:
  - "[email protected]"
  - "[email protected]"
keepalived_global_defs:
  vrrp_garp_master_refresh: 60

Exemple d'utilisation minimale

Vous devez au moins définir ces variables :

# Par hôte
keepalived_role:
  "VI_1": "MASTER"

# Par groupe
keepalived_vrrp_instances:
  "VI_1":
    virtual_router_id: 10
    shared_iface: eth0
    shared_vips:
      - '10.127.50.5'
    auth_pass: 'NLxQZYzXUfhjkJqWzVrPMua'

Licence

"LA LICENCE (étendue) DE LA BIERE" (Révision 42.0815):

Tant que vous conservez cet avis, vous pouvez faire ce que vous voulez avec ces choses. Si un jour nous nous rencontrons et que vous pensez que cela en vaut la peine, vous pouvez m'offrir des bières en retour.

Informations sur l'auteur

Youenn Piolet

À propos du projet

Keepalived Configuration

Installer
ansible-galaxy install uZer.keepalived
Licence
other
Téléchargements
3.9k
Propriétaire
What year is this?