Coder Social home page Coder Social logo

ansible-keepalived's Introduction

Keepalived

This role installs keepalived and configures it according to the variables you'll pass to the role.

Requirements

No fancy requirements. Only package and file management in the role.

Role Variables

By default, this role doesn't configure keepalived, it barely installs it. This way keepalived is fully flexible based on what you give as input. Examples are given in the vars folder. Don't try them immediately, they won't work! (You need to define VIPs, passwords, etc.). The examples are only a source of inspiration.

The main variables are:

  • keepalived_instances: This is a mandatory dict. It gathers information about the vips, the prefered state (master/backup), the VRRIP IDs and priorities, the password used for authentication... This is where things like nopreempt are configured. nopreempt allows to stay in backup state (instead of preempting to configured master) on a master return of availability, after its failure. Please check the template for additional settings support, and original keepalived documentation for their configuration.
  • keepalived_sync_groups: This is a mandatory dict. It groups items defined in keepalived_instances, and (if desired) allow the configuration of notifications scripts per group of keepalived_instances. Notification scripts are triggered on keepalived's state change and are facultative.
  • keepalived_virtual_servers: This is an optional dict. It sets up a virtual server + port and balances traffic over real_servers given in a sub dict. Checkout the _example.yaml files in vars/ to see a sample on how to use this dict. The official documentation for keepalived's virtual_server can be found here.
  • keepalived_scripts: This is an optional dict where you could have checking scripts that can trigger the notifications scripts.
  • keepalived_bind_on_non_local: This variable (defaulted to "False") determines whether the system that host keepalived will allow its apps to bind on non-local addresses. If you set it to true, this allows apps to bind (and start) even if they don't currently have the VIP for example.

Please check the examples for more explanations on how these dicts must be configured.

Other editable variables are listed in the defaults/main.yml. Please read the explanation there if you want to override them. An example of a notification script is also given, in the files folder.

Antoher good source of informations is the official keepalived GIT repo where you can find a fully commented keepalived.conf. Also various official samples are provided.

Dependencies

No dependency

Example Playbook

Here is how you could use the role:

- hosts: keepalived_hosts[0]
  vars_files:
    - roles/keepalived/tests/keepalived_haproxy_master_example.yml
  roles:
     - keepalived
- hosts: keepalived_hosts:!keepalived_hosts[0]
  vars_files:
    - roles/keepalived/tests/keepalived_haproxy_backup_example.yml
  roles:
     - keepalived

Or more simply:

- hosts: keepalived_hosts
  vars_files:
    - roles/keepalived/tests/keepalived_haproxy_combined_example.yml
  roles:
     - keepalived

You could also replace the vars_files by proper group_vars, host_vars.

License

Apache2

Author Information

Jean-Philippe Evrard

ansible-keepalived's People

Contributors

bjoernt avatar carter1980 avatar cloudnull avatar evrardjp avatar james-portman avatar jardleex avatar logan2211 avatar major avatar mancdaz avatar mgariepy avatar ray76 avatar rlex avatar timl avatar touchardv avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.