{"id":20263600,"url":"https://github.com/springerpe/chef_pe_keepalived","last_synced_at":"2025-12-01T01:08:51.374Z","repository":{"id":19393901,"uuid":"22635224","full_name":"SpringerPE/chef_pe_keepalived","owner":"SpringerPE","description":"Repo for keepalived cookbook","archived":false,"fork":false,"pushed_at":"2014-08-05T08:44:09.000Z","size":160,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-19T11:35:03.696Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SpringerPE.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-05T07:52:42.000Z","updated_at":"2017-02-13T22:16:54.000Z","dependencies_parsed_at":"2022-08-21T07:10:42.298Z","dependency_job_id":null,"html_url":"https://github.com/SpringerPE/chef_pe_keepalived","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/SpringerPE/chef_pe_keepalived","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringerPE%2Fchef_pe_keepalived","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringerPE%2Fchef_pe_keepalived/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringerPE%2Fchef_pe_keepalived/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringerPE%2Fchef_pe_keepalived/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpringerPE","download_url":"https://codeload.github.com/SpringerPE/chef_pe_keepalived/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpringerPE%2Fchef_pe_keepalived/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27418931,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-30T02:00:05.582Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T11:35:41.285Z","updated_at":"2025-12-01T01:08:51.360Z","avatar_url":"https://github.com/SpringerPE.png","language":"Ruby","readme":"# pe_keepalived cookbook\n\nCookbook to setup keepalived clusters (for HA and load balancing) in a flexible way. \nIt supports all keepalived parameters and it can read all of them from a databag.\n\n * Support to add all necessary sysctl parameters                                            \n * With DR, it will setup the VIP in all nodes using dummy network interface\n\n\n## Supported Platforms\n\n * Debian\n * Ubuntu\n * Centos\n * RedHat\n\n## Attributes\n\nTo can define the attributes, or use a databag to read and setup all of them.\nFor instance, here you see the attribute file of this cookbook:\n\n```\n### Main attributes\ndefault[:pe_keepalived][:data_bag] = 'network'\ndefault[:pe_keepalived][:bag_name] = 'keepalived'\ndefault[:pe_keepalived][:environment] = node[:chef_environment] ? node[:chef_environment] : \"_default\"\n\n### Options\ndefault[:pe_keepalived][:lvs_id_device] = 'eth0'     # 'lvs_id' will be the ip of that device\ndefault[:pe_keepalived][:nonlocal_bind] = true       # allow binding to a non defined IP\ndefault[:pe_keepalived][:virtual_device] = 'dummy0'  # or 'lo' to avoid loading dummy kernel module\ndefault[:pe_keepalived][:auto_check] = true          # if no TCP checks are defined, they will be created.\n\n### Keepalived attributes (see manual)\ndefault[:pe_keepalived][:global] = {         # keepalived 'global_defs' parameters\n    :notification_emails =\u003e ['root'],\n    :email_from =\u003e \"keepalived@#{node[:fqdn]}\",\n    :smtp_server =\u003e 'localhost'\n}\n# Usually empty. They will be filled automatically\ndefault[:pe_keepalived][:static_ipaddress] = []\ndefault[:pe_keepalived][:static_routes] = []\n# Main configuration (see manual)\ndefault[:pe_keepalived][:sync_groups] = {    # example configuration with Haproxy (commented parameters are\n#                                            # not necessary.\n#    'haproxy' =\u003e {                          # keepalived 'vrrp_sync_group' section parameters.\n#        #:notify_backup =\u003e \"script1\",\n#        #:notify_fault =\u003e \"script2\",\n#        #:notify_master =\u003e \"script3\",\n#        :instances =\u003e {\n#            'web' =\u003e {                      # keepalived 'vrrp_instance' section parameters except :master,\n#                                            # :virtual_ipaddress and :scripts.\n#                :master =\u003e '23.23.23.23',   # cookbook parameter to define which real server will be the master\n#                                            # not necessary if priority is defined in each real server.\n#                'interface' =\u003e 'eth1',      # interface were the virtual IP will be available.\n#                #'smtp_alert' =\u003e true,\n#                #:virtual_ipaddress =\u003e ['12.12.12.12'],   # if not virtualserver, this entry (and :master) will\n#                                                          # be used. Useful with Haproxy.\n#                #'auth_type' =\u003e 'PASS',\n#                #'auth_pass' =\u003e 'dsfasfadfad',            # if no password is defined, it will be filled with \n#                                                          # the 1st IP of :virtual_ipaddress (or virtualserver).\n#                :scripts =\u003e {                             # scripts to manage the services.\n#                    'chk_haproxy'=\u003e {\n#                        'script' =\u003e \"killall -0 haproxy\",\n#                        'interval' =\u003e 2,\n#                        'weight' =\u003e 2\n#                     },\n#                },\n#                'virtualserver' =\u003e {                      # definition of the services with format 'vip:port'.\n#                    '13.13.13.13:80' =\u003e {                 # it can be an empty hash if no :virtual_ipaddress.\n#                          #'delay_loop' =\u003e 30,            # keepalived 'virtual_server' parameters.\n#                          #'lb_algo' =\u003e 'rr',\n#                          #'lb_kind' =\u003e 'DR',\n#                          #'persistence_timeout' =\u003e '60',\n#                          #'protocol' =\u003e 'TCP',\n#                          #'servers' =\u003e {                 # keepalived 'real_server' parameters, except\n#                                                          # :priority. \n#                              #'23.23.23.23:80' =\u003e {\n#                                  #:priority' =\u003e 200,     # value to work out the master if no :master defined.\n#                                  #'weight' =\u003e 20,\n#                                  #'HTTP_GET' =\u003e {\n#                                      #'url' =\u003e {\n#                                          #'path' =\u003e \"/testurl2/test.jsp\",\n#                                          #'digest' =\u003e \"640205b7b0fc66c1ea91c463fac6334c\",\n#                                      #},\n#                                      #'connect_timeout' =\u003e 3,\n#                                      #'nb_get_retry' =\u003e 3,\n#                                      #'delay_before_retry' =\u003e 2\n#                                  #}                               \n#                              #},\n#                              #'24.24.24.24:80' =\u003e {      # if no checks are defined, it will create a TCP\n#                                                          # on the port.\n#                                  #'weight' =\u003e 30                      \n#                              #}\n#                          #}\n#                    }\n#                }\n#            }\n#        }\n#    }\n}\n\n```\nThe structure of the keepalived configuration is almost its own configuration, except the attributes defined with \n`:` like  `:master`, `:scripts`, etc\n\nYou can see all the keepalived parameters http://www.keepalived.org/documentation.html\n\n## Usage\n\nThe easy way is just use a databag to define a cluster of servers. For example, to define a basid Haproxy HA \nconfiguration:\n```json\n{\n    \"id\": \"keepalived\",\n    \"_default\": {\n        \"sync_groups\": {\n            \"haproxy\": {\n                \"instances\": {\n                    \"web\": {\n                        \"master\": \"10.10.10.20\", \n                        \"interface\": \"eth1\",\n                        \"virtual_ipaddress\": [\"10.10.10.50\"],\n                        \"scripts\": {          \n                            \"chk_haproxy\": {\n                                \"script\": \"killall -0 haproxy\",\n                                \"interval\": \"2\",\n                                \"weight\": \"2\"\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n}\n```\n\nThis will generate a configuration to get Haproxy running on 10.10.10.50, with the master server in 10.10.10.20, all \nthe rest serverwill be slaves.\n\n\nTo apply the cookbook just include `pe_keepalived` in your node's `run_list`:\n\n```json\n{\n  \"run_list\": [\n    \"recipe[pe_keepalived::default]\"\n  ]\n}\n```\n\n# Author\n\nAuthor:: Jose Riguera (Springer SBM) (\u003cjose.riguera@springer.com\u003e)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspringerpe%2Fchef_pe_keepalived","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspringerpe%2Fchef_pe_keepalived","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspringerpe%2Fchef_pe_keepalived/lists"}