Git Product home page Git Product logo

keepalived's Introduction

keepalived Cookbook

Cookbook Version CI State OpenCollective OpenCollective License

Installs keepalived and generates the configuration files, using resource-driven configuration.

Maintainers

This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.

Requirements

Platforms

  • Debian/Ubuntu
  • RHEL/CentOS/Scientific/Amazon/Oracle

Chef

  • Chef 15.3+

Recommended Background Reading

Resources

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers!

https://opencollective.com/sous-chefs#backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

https://opencollective.com/sous-chefs/sponsor/0/website https://opencollective.com/sous-chefs/sponsor/1/website https://opencollective.com/sous-chefs/sponsor/2/website https://opencollective.com/sous-chefs/sponsor/3/website https://opencollective.com/sous-chefs/sponsor/4/website https://opencollective.com/sous-chefs/sponsor/5/website https://opencollective.com/sous-chefs/sponsor/6/website https://opencollective.com/sous-chefs/sponsor/7/website https://opencollective.com/sous-chefs/sponsor/8/website https://opencollective.com/sous-chefs/sponsor/9/website

keepalived's People

Contributors

axelrtgs avatar bodgix avatar damacus avatar danielsdeleo avatar detjensrobert avatar gfrntz avatar guilhem avatar jarosser06 avatar jmccann avatar johnroesler avatar jonathansbach avatar kitchen-porter avatar kyann avatar lehn-etracker avatar linkfanel avatar nathenharvey avatar nathwill avatar nimeshsubramanianv2 avatar powerschill avatar ramereth avatar renovate[bot] avatar sebastianriese avatar sethvargo avatar tas50 avatar thirumoorthir avatar tramaswami avatar tyrael avatar xorima avatar xorimabot avatar zedtux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

keepalived's Issues

Incompatibility with Chef 13

The keepalived_vrrp_instance resource has a property named "state" which is the name of a internal method on the resource class in Chef. As of Chef 13 we're no longer allowing the reuse of these names so this will fail. We'll need to rename this to something not used internally.

Keepalived version is inconsistent

Hi folks,

Keepalived cookbook version is inconsistent with master branch, 1.2 git tag supermarket.

I am totally lost...
do I miss something ? or someone has forgotten to push git commits ?

keepalived_vrrp_instance config file parameter order causes keepalived failure

Cookbook version

2.0.0

Chef-client version

12.11.18

Platform Details

Ubuntu 14.04; AWS

Scenario:

Configure VRRP Instance with unicast peer. Per https://blog.logentries.com/2014/12/keepalived-and-haproxy-in-aws-an-exploratory-guide/

Steps to Reproduce:

Add VRRP instance config like:

  keepalived_vrrp_instance 'test' do
    virtual_router_id 42
    # Making both backup and adding `nopreempt` is a trick that prevent the master taking over the IP once it comes back
    # this is desirable in our case as it likely has a blip of lost data that the backup doesn't
    state 'BACKUP'
    nopreempt true
    interface eth0
    priority 100
    authentication auth_type: 'PASS', auth_pass: 'foo'
    unicast_src_ip '10.0.0.1'
    unicast_peer ['10.0.0.2']
    notify_master "/usr/local/bin/failover.sh"
  end

Expected Result:

Working VRRP instance

Actual Result:

The config file is rendered in some "random" order (i.e. however ruby hash ordered the keys I suspect)

But it seems like keepalived requires virtual_router_id to be before unicast_peers.

For me the file is rendered as:

vrrp_instance test {
        notify_master /usr/local/bin/failover.sh
        state BACKUP
        interface eth0
        unicast_src_ip 10.0.0.1
        unicast_peer {
                10.0.0.2
                }
        virtual_router_id 42
        priority 100
        authentication {
                auth_type PASS
                auth_pass foo
                }
        nopreempt
        }

Which results in VRRP crashing on load and respawning in a tight loop with:

Starting VRRP child process, pid=8932
Interface queue is empty
Netlink reflector reports IP 10.0.0.1 added
Netlink reflector reports IP fe80::c40:55ff:fe84:4cc3 added
Registering Kernel netlink reflector
Registering Kernel netlink command channel
Registering gratuitous ARP shared channel
Initializing ipvs 2.6
Opening file '/etc/keepalived/keepalived.conf'.
Opening file '/etc/keepalived/conf.d/keepalived_vrrp_instance__test__.conf'.
VRRP_Instance(prometheus) the virtual id must be set!
VRRP child process(8932) died: Respawning
[repeat]

That was from running it in foreground with keepalived -n -l -D -f /etc/keepalived/keepalived.conf

If I move the virtual_router_id line up anywhere before the unicast_peer one, keepalived starts successfully:

$keepalived -n -l -D -f /etc/keepalived/keepalived.conf
Starting Healthcheck child process, pid=9280
Initializing ipvs 2.6
Starting VRRP child process, pid=9281
Interface queue is empty
Netlink reflector reports IP 10.0.0.1 added
Netlink reflector reports IP fe80::c40:55ff:fe84:4cc3 added
Registering Kernel netlink reflector
Registering Kernel netlink command channel
Interface queue is empty
Netlink reflector reports IP 10.0.0.1 added
Opening file '/etc/keepalived/keepalived.conf'.
Netlink reflector reports IP fe80::c40:55ff:fe84:4cc3 added
Registering Kernel netlink reflector
Registering Kernel netlink command channel
Opening file '/etc/keepalived/conf.d/keepalived_vrrp_instance__test__.conf'.
Registering gratuitous ARP shared channel
Initializing ipvs 2.6
Configuration is using : 5821 Bytes
Using LinkWatch kernel netlink reflector...
Opening file '/etc/keepalived/keepalived.conf'.
Opening file '/etc/keepalived/conf.d/keepalived_vrrp_instance__test__.conf'.
Configuration is using : 59592 Bytes
Using LinkWatch kernel netlink reflector...
VRRP_Instance(test) Entering BACKUP STATE
VRRP sockpool: [ifindex(2), proto(112), fd(10,11)]
VRRP_Instance(test) Transition to MASTER STATE
VRRP_Instance(test) Entering MASTER STATE
Opening script file /usr/local/bin/failover.sh

I'm not sure why keepalived seems so sensitive to ordering in the config files nor which other possible parameters might cause a similar issue.

For now It means I have to bypass the keepalived_vrrp_instance entirely and write my config file explicitly...

Update Changelog

🗣️ Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

👻 Brief Description

Update all CHANGELOGs to follow standard defined at https://keepachangelog.com/

Issue sprouted from sous-chefs/meta/issues/101. If not applicable then issue should be closed.

notify_master is duplicated on keepalived_vrrp_instance resources

👻 Brief Description

On vrrp_instances the notify_master script is duplicated.

🥞 Cookbook version

On versions after v4.0.0

Steps To Reproduce

Create an instance:

keepalived_vrrp_instance 'inside_network' do
  master true
  interface node['network']['default_interface']
  virtual_router_id 51
  priority 101
  authentication auth_type: 'PASS', auth_pass: 'secret1'
  virtual_ipaddress %w( 192.168.1.1 )
  notify_master "/tmp/test.sh"
  smtp_alert true
end

And run the cookbook.
The file will contain the notify_master "/tmp/test.sh" line twice.

🚓 Expected behavior

The generated file should contain the following line: notify_master "/tmp/test.sh" only once.

Change to Custom Resources

Currently we are using HWRP which are not user friendly at all, we should convert all of these to custom resources

As part of this we should also move all logic into libraries and increase spec tests to cover all logic and resources where possible

End Goal: No recipes or HWRP, only custom resources, the current API should be kept if possible so user experience does not change

All work for this should be merged into the dev branch until ready to release

ArgumentError when setting keepalived_vrrp_instance state property

Cookbook version

3.1.0

Chef-client version

12.19.36

Platform Details

CentOS 7

Scenario:

keepalived_vrrp_instance throws and ArgumentError when setting the state parameter. "wrong number of arguments (given 1, expected 0)"

Steps to Reproduce:

Here's the resource block I'm getting this on:

keepalived_vrrp_instance 'VI_1' do
      virtual_router_id routerId
      state nodeState
      interface "eth0"
      priority routerPriority
      unicast_src_ip source_ip
      unicast_peer peer_ip
      virtual_ipaddress vip
      track_script chk_haproxy
  end

The same error appears for this property order as well:

keepalived_vrrp_instance 'VI_1' do
      state nodeState
      virtual_router_id routerId
      interface "eth0"
      priority routerPriority
      unicast_src_ip source_ip
      unicast_peer peer_ip
      virtual_ipaddress vip
      track_script chk_haproxy
  end

Both error when setting the state.

Expected Result:

State is set in keepalived configuration and VRRP instance works properly

Actual Result:

Chef client fails to run.

================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/ps-keepalived/recipes/default.rb
================================================================================

ArgumentError
-------------
wrong number of arguments (given 1, expected 0)

Cookbook Trace:
---------------
  /var/chef/cache/cookbooks/ps-keepalived/recipes/default.rb:64:in `block in from_file'
  /var/chef/cache/cookbooks/ps-keepalived/recipes/default.rb:62:in `from_file'

Relevant File Content:
----------------------
/var/chef/cache/cookbooks/ps-keepalived/recipes/default.rb:

 57:        interval 2
 58:        weight 2
 59:        script '"killall -0 haproxy"'
 60:    end
 61:
 62:    keepalived_vrrp_instance 'VI_1' do
 63:        virtual_router_id routerId
 64>>       state nodeState
 65:        interface "eth0"
 66:        priority routerPriority
 67:        unicast_src_ip source_ip
 68:        unicast_peer peer_ip
 69:        virtual_ipaddress vip
 70:        track_script chk_haproxy
 71:    end
 72:
 73:  else

Platform:
---------
x86_64-linux

I have tried state 'MASTER' as well, just as you have in the README. That also doesn't work.

keepalived_vrrp_instance authentication doesn't accept hash

Cookbook version

3.1.0

Chef-client version

12.19.36

Platform Details

centos 6

Scenario:

pass to keepalived_vrrp_instance attribute authentication as hash

Steps to Reproduce:

  1. Call keepalived_vrrp_instance with attribute authentication set to hash
  2. Run chef

Expected Result:

Chef client run completed successfully

Actual Result:

Chef::Exceptions::ValidationFailed
----------------------------------
Option authentication's value {"auth_type"=>"PASS", "auth_pass"=>"passwd"} has required configuration!

More information:

Example vrrp_config hash:

default['kad']['vrrp_config'] = {
  authentication: {
    auth_type: 'PASS',
    auth_pass: 'passwd',
  },
}

Calling keepalived_vrrp_instance with data structure

keepalived_vrrp_instance 'test' do
  authentication node['kad']['vrrp_config']['authentication']
  interface node['network']['default_interface']
  virtual_router_id 50
  priority 100
  advert_int 1
  virtual_ipaddress ['192.168.1.110']
end

Suspected to be here: https://github.com/chef-cookbooks/keepalived/blob/3a0c323e843e678fde1ce8767413da85b291562c/libraries/keepalived.rb#L129-L131

keepalived_vrrp_instance updates are not picked up by keepalived automatically

Cookbook version

3.0.2

Chef-client version

12.21.4

Platform Details

Ubuntu 16.04 Linux

Scenario:

We have several keepalived_vrrp_instance resources for service IPs. Currently, changes to those resources are not automatically picked up by keepalived.

Steps to Reproduce:

  1. Create a keepalived_vrrp_resource
  2. Observe that keepalived does not immediately act on it

Discussion

So we’re not entirely sure if this should be this cookbook’s job. On the one hand, it would be neat if the keepalived_vrrp_resource automatically notified the keepalived service for reloading immediately (or delayed?) when the resource has updated. On the other hand, this might not always be desirable (e.g. when changing multiple such resources and one wants the changes to take effect at the same time…).

We would consider providing a patch for such a notification if this is something wanted by the developers.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • sous-chefs/.github 3.1.0
  • actions/checkout v4
  • actionshub/chef-install 3.0.0
  • actionshub/test-kitchen 2.1.0
.github/workflows/stale.yml
  • actions/stale v9

  • Check this box to trigger a request for Renovate to run again on this repository

The cookbook is no longer compatible with Chef 13, 14 – value_for_platform_family is not available in resources

👻 Brief Description

When running the kitchen tests with Chef 13 or Chef 14 they fail with an undefined method error. The call was introduced between v4.0.0 and v5.0.0. Chef 14 is not yet EOL and the cookbook metadata still claims compatibility with Chef 13. So this should be fixed.

A lot of organizations use chef client versions beyond their EOL.

🥞 Cookbook version

v5.0.0

👩‍🍳 Chef-Infra Version

14.13.11 (or earlier)

🎩 Platform details

kitchen tests with dokken and the bento/ubuntu-1804 image.

Steps To Reproduce

  1. Run the kitchen tests with the appropriate environment: CHEF_VERSION=15 KITCHEN_LOCAL_YAML=kitchen.dokken.yml kitchen converge default-ubuntu-1804
  2. The converge fails with the following errors:
================================================================================
Recipe Compile Error in /opt/kitchen/cache/cookbooks/keepalived/resources/install.rb
================================================================================

NoMethodError
-------------
undefined method `value_for_platform_family' for #<Class:0x0000000003a5d450>

Cookbook Trace:
---------------
  /opt/kitchen/cache/cookbooks/keepalived/resources/install.rb:6:in `class_from_file'

Relevant File Content:
----------------------
/opt/kitchen/cache/cookbooks/keepalived/resources/install.rb:

  1:  property :package_name, String, default: 'keepalived'
  2:  property :root_path,    String, default: '/etc/keepalived'
  3:  property :config_path,  String, default: lazy { "#{root_path}/conf.d" }
  4:  property :server_path,  String, default: lazy { "#{root_path}/servers.d" }
  5:  property :health_path,  String, default: lazy { "#{root_path}/checks.d" }
  6>> property :defaults_path, String, default: value_for_platform_family(
  7:                                              debian: '/etc/default/keepalived',
  8:                                              default: '/etc/sysconfig/keepalived'
  9:                                            )
 10:  action :install do
 11:    package new_resource.package_name
 12:  
 13:    [
 14:      new_resource.config_path,
 15:      new_resource.server_path,

System Info:
------------
chef_version=14.13.11
platform=ubuntu
platform_version=18.04
ruby=ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]
program_name=/opt/chef/embedded/bin/chef-client
executable=/opt/chef/embedded/bin/chef-client

🚓 Expected behavior

The converge is successful.

➕ Additional context

I found this issue while trying to test my changes to fix #74. My organization still uses Chef 14, so I needed to test that it works.

I don't quite get why it does not work, since the method is in the Chef::DSL::Universal module, that has for a long time been included everywhere.

keepalived::default does not converge on the latest CentOS 7 and Debian 9

Cookbook version

3.1.0

Chef-client version

13.6.4-1

Platform Details

centos-7
debian-9

Scenario:

keepalived::default does not converge on the latest versions of debian-9 and centos-7

Steps to Reproduce:

kitchen test centos-7
kitchen test debian-9

Expected Result:

Finished in 0.22866 seconds (files took 0.29889 seconds to load)
26 examples, 0 failures

Actual Result:

        * service[keepalived] action start

           ================================================================================
           Error executing action `start` on resource 'service[keepalived]'
           ================================================================================

           Mixlib::ShellOut::ShellCommandFailed
           ------------------------------------
           Expected process to exit with [0], but received '1'
           ---- Begin output of /bin/systemctl --system start keepalived ----
           STDOUT:
           STDERR: Job for keepalived.service failed because the control process exited with error code. See "systemctl status keepalived.service" and "journalctl -xe" for details.
           ---- End output of /bin/systemctl --system start keepalived ----
           Ran /bin/systemctl --system start keepalived returned 1

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/keepalived/recipes/service.rb

            20: service 'keepalived' do
            21:   supports restart: true
            22:   action [:enable, :start]
            23:   subscribes :restart, 'file[keepalived.conf]', :delayed
            24:   subscribes :restart, 'file[keepalived-options]', :delayed
            25: end

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/keepalived/recipes/service.rb:20:in `from_file'

           service("keepalived") do
             action [:enable, :start]
             updated true
             default_guard_interpreter :default
             service_name "keepalived"
             enabled true
             running false
             masked false
             pattern "keepalived"
             declared_type :service
             cookbook_name "keepalived"
             recipe_name "service"
             supports {:restart=>true}
           end

           System Info:
           ------------
           chef_version=13.6.4
           platform=centos
           platform_version=7.4.1708
           ruby=ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
           program_name=chef-client worker: ppid=2723;start=16:30:01;
           executable=/opt/chef/bin/chef-client

         * service[keepalived] action restart

           ================================================================================
           Error executing action `restart` on resource 'service[keepalived]'
           ================================================================================

           Mixlib::ShellOut::ShellCommandFailed
           ------------------------------------
           Expected process to exit with [0], but received '1'
           ---- Begin output of /bin/systemctl --system restart keepalived ----
           STDOUT:
           STDERR: Job for keepalived.service failed because the control process exited with error code. See "systemctl status keepalived.service" and "journalctl -xe" for details.
           ---- End output of /bin/systemctl --system restart keepalived ----
           Ran /bin/systemctl --system restart keepalived returned 1

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/keepalived/recipes/service.rb

            20: service 'keepalived' do
            21:   supports restart: true
            22:   action [:enable, :start]
            23:   subscribes :restart, 'file[keepalived.conf]', :delayed
            24:   subscribes :restart, 'file[keepalived-options]', :delayed
            25: end

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/keepalived/recipes/service.rb:20:in `from_file'

           service("keepalived") do
             action [:enable, :start]
             updated true
             default_guard_interpreter :default
             service_name "keepalived"
             enabled true
             running false
             masked false
             pattern "keepalived"
             declared_type :service
             cookbook_name "keepalived"
             recipe_name "service"
             supports {:restart=>true}
           end

           System Info:
           ------------
           chef_version=13.6.4
           platform=centos
           platform_version=7.4.1708
           ruby=ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
           program_name=chef-client worker: ppid=2723;start=16:30:01;
           executable=/opt/chef/bin/chef-client

Need support for more keepalived keywords

Need support for the following keepalived keywords

* garp_master_repeat 
* garp_master_refresh 
* garp_master_refresh_repeat
* smtp_alert
* notify_master
* notify_backup
* notify_fault 
* garp_master_delay
* fall a check_script keyword
* rise a check_script keyword

Add a template for controlling KEEPALIVED_OPTIONS daemon args

Cookbook version

master

Chef-client version

any

Platform Details

n/a

Scenario:

control keepalived daemon args

Steps to Reproduce:

try to control keepalived daemon args

Expected Result:

some configuration permits to control the daemon args via /etc/default/keepalived or /etc/sysconfig/keepalived

Actual Result:

no such option

Mark recipes as deprecated

👻 Brief Description

We will be getting rid of recipes in the next major release, we should add a log resource of level warn to each recipe at the end saying that recipes will be deprecated in the next release and to move onto available resources

Note: We should also update the documentation for things we are not going to be managing, such as the service resource, this should be done with notifies from the correct resources etc

🥞 Cookbook version

current master

🚓 Expected behavior

Chef logs a warning

Run latest cookstyle

🗣️ Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

👻 Brief Description

Chef have released updated cookstyle rules, we should therefore run the auto fix against the cookbook

  1. Ensure you are on the latest stable chef-workstation
  2. Run cookstyle -a

Issue sprouted from sous-chefs/meta/issues/111. If not applicable then issue should be closed.

Update builds to be parallel

🗣️ Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

👻 Brief Description

As part of our build process we should build each possible operating system separately

  1. Ensure you have dokken setup and working:
  2. dokken: aliased to KITCHEN_LOCAL_YAML=kitchen.dokken.yml kitchen
  3. run dokken list, you should see a list of builds with dokken as the provider
  4. download: https://github.com/sous-chefs/repo-management/blob/master/scripts/circleci_maker.rb and make this executable
  5. run: dokken list -j | ./circleci_maker.rb > .circleci/config.yml

Issue sprouted from sous-chefs/meta/issues/112. If not applicable then issue should be closed.

cookbook uses retry keyword as property

Cookbook version

latest master

Chef-client version

any

Platform Details

any

Scenario:

n/a

Steps to Reproduce:

n/a

Expected Result:

cookbook doesn't use ruby retry keyword as a property

Actual Result:

woops, cookbook uses ruby retry keyword as a property

Update KeepAliveD cookbook to reflect new options for keepalived.conf

Cookbook version

https://supermarket.chef.io/cookbooks/keepalived/versions/3.0.1

Chef-client version

Chef-Client 12.18.31 RHEL 6.8 x86_64

Platform Details

Red Hat Enterprise Linux 6.8 x86_64

Scenario:

Attempting to use new settings in KeepAliveD Configuration to allow scripts to be executed with KeepAliveD 1.3.2. KeepAliveD 1.2.13, the one in most Yum Repositories, has issues with SELinux allowing it to execute scripts. After building from source for 1.3.2, scripts are attempting to be executed, but there are no spots for settings listed here.
https://github.com/acassen/keepalived/blob/master/doc/keepalived.conf.SYNOPSIS

Steps to Reproduce:

Build KeepAliveD 1.3.2 from source. Attempt to input user into vrrp_script, chef-client run fails.

Expected Result:

This should add the user to the vrrp_script block allowing KeepAliveD to execute vrrp_scripts, as well as notifiy scripts.

Actual Result:

16:52:39 # chef-client -z -o recipe[zabbix_keepalived::default]
[2017-02-07T16:52:49+00:00] WARN: No config file found or specified on command line, using command line options.
Starting Chef Client, version 12.18.31
[2017-02-07T16:52:53+00:00] WARN: Run List override has been provided.
[2017-02-07T16:52:53+00:00] WARN: Original Run List: []
[2017-02-07T16:52:53+00:00] WARN: Overridden Run List: [recipe[zabbix_keepalived::default]]
resolving cookbooks for run list: ["zabbix_keepalived::default"]
Synchronizing Cookbooks:
  - keepalived (3.0.1)
  - zabbix_keepalived (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...

================================================================================
Recipe Compile Error in /root/.chef/local-mode-cache/cache/cookbooks/zabbix_keepalived/recipes/default.rb
================================================================================

NoMethodError
-------------
undefined method `user' for ChefKeepalived::Resource::VrrpScript

Cookbook Trace:
---------------
  /root/.chef/local-mode-cache/cache/cookbooks/zabbix_keepalived/recipes/default.rb:24:in `block in from_file'
  /root/.chef/local-mode-cache/cache/cookbooks/zabbix_keepalived/recipes/default.rb:18:in `from_file'

Relevant File Content:
----------------------
/root/.chef/local-mode-cache/cache/cookbooks/zabbix_keepalived/recipes/default.rb:

 17:
 18:  keepalived_vrrp_script 'chk_zabbix' do
 19:    interval 2
 20:    weight 20
 21:    fall 3
 22:    rise 1
 23:    script '/etc/keepalived/notify.sh chk'
 24>>   user 'root' 'root'
 25:    init_fail
 26:  end
 27:
 28:  keepalived_vrrp_instance 'ccf_1' do
 29:    notify_master '"/etc/keepalived/notify.sh start" root root'
 30:    notify_backup '"/etc/keepalived/notify.sh stop" root root'
 31:    notify_fault '"/etc/keepalived/notify.sh stop" root root'
 32:    smtp_alert true
 33:    state 'MASTER'

Platform:
---------
x86_64-linux


Running handlers:
[2017-02-07T16:52:53+00:00] ERROR: Running exception handlers
Running handlers complete
[2017-02-07T16:52:53+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 03 seconds
[2017-02-07T16:52:53+00:00] FATAL: Stacktrace dumped to /root/.chef/local-mode-cache/cache/chef-stacktrace.out
[2017-02-07T16:52:53+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-02-07T16:52:53+00:00] ERROR: undefined method `user' for ChefKeepalived::Resource::VrrpScript
[2017-02-07T16:52:53+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)```

not able to install keepalived

👻 Brief Description

I am trying to use keepalived cookbook to install on centos 7 machine, I have included the dependency in metadata.rb file. When I ran the chef-client it resulted in undefined local variable or method. I am using the latest chef client (15.4.45)

Undefined local variable or method `keepalived' for cookbook: nrhl_haproxy, recipe: keepalived :Chef::Recipe

keepalived.rb:
1>> keepalived::install

Keepalived version: 3.1.1
OS: centos7
chef-client: 15.4.45

keepalived_vrrp_instance has required properties that should not be required

👻 Brief Description

The properties authentication and virtual_router_id of the keepalived_vrrp_instance resource are required, but should not be, as they are simply ignored when deleting instances.

Apart from that, requiring authentication is a really bad idea. Authentication in VRRP has been deprecated for use with VRRPv2 since 2004 (!) https://tools.ietf.org/html/rfc3768#section-10, and is not defined at all in VRRPv3 – so VRRPv3 instances created with this cookbook lead to a warning with keepalived (saying that the authentication configuration is ignored).

The validation that a virtual_router_id is set would have to be delayed to the :create action, while this unfortunately leads to run-time failures, there is no remedy if a convenient :delete action shall be supported.

If you agree with my proposal I would be happy to make a PR fixing the issue.

🥞 Cookbook version

all up to 3.1.1

👩‍🍳 Chef-Infra Version

14.8.12 (irrelevant for the issue)

🎩 Platform details

Ubuntu 18.04 (mostly irrelevant for the issue)

Steps To Reproduce

  1. Try to create a VRRPv3 instance, you have to specify authentication, and keepalived will emit a warning due to ignored configuration

    keepalive_vrrp_instance 'instance_v3' do
      # ... other configuration ...
      version 3
      authentication(
       auth_type: 'PASS',
       auth_pass: 'fnord'
     )
    end
    
  2. Try to delete a VRRP instance, you will have to write

    keepalived_vrrp_instance 'instance_name' do
      action :delete
    
      # these are just workarounds for the keepalived cookbook's
      # creative use of required options
      virtual_router_id 0
      authentication(
        auth_type: 'PASS',
        auth_pass: 'fnord'
      )
    end
    

🚓 Expected behavior

  1. It should be possible to create valid configuration for VRRPv3

    keealived_vrrp_instance 'instance_v3' do
       version 3
       # ... other configuration, but *not* authentication block     
    end
    
  2. It should be possible to delete a VRRP instance by just saying

    keepalived_vrrp_instance 'instance_name' do
        action :delete
    end
    

Remove .rubocop.yml with Dangerfile

🗣️ Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

👻 Brief Description

If the only thing in the .rubocop/yml is Dangerfile
Run the latest cookstyle
Remove .rubpopo.yml

Issue sprouted from sous-chefs/meta/issues/108. If not applicable then issue should be closed.

Please release the new code: v.1.3.0 is missing the notify script settings

I need the full set of keepalive configuration attributes you have in your development code:

:smtp_alert => true # Enables SMTP notifications
:notify_master => nil # Script to be run on transition to MASTER state
:notify_backup => nil # Script to be run on transition to BACKUP state
:notify_fault => nil # Script to be run when check_script fails

Do you now when the new version will be released?

Instances don't support have a notify_script set

When defining a instance in overrides, most required settings can be set except notify_script, for some users this is a requirement.

A instance can have only one notify_script set and would be set like so, keepalived['instances']['instance_name']['notify_script'] = '/etc/keepalived/notify.sh' (This is just an example, other users may have it sent to something else)

invalid data type for track_interface option

property :track_interface, Array

Hello.
The documentation says that the option track_interface accepts a String data type. However, the accepted type is specified in the resource code an Array, which does not allow passing a String with data: the interface name and weight.

keepalived_vrrp_instance router['name'] do
        master router['master']
        interface router['iface']
        virtual_router_id router['router_id']
        priority router['router_priority']
        advert_int router['advert_int']
        authentication auth_type: 'PASS', auth_pass: 'secret1'
        unicast_src_ip router['unicast_src_ip']
        unicast_peer router['unicast_peer']
        virtual_ipaddress router['virtual_ip']
        **track_interface router['track_interface']**
        smtp_alert true
        notifies :restart, 'service[keepalived]', :delayed
router['track_interface'] = 'eth1 weight 10'
FATAL: Chef::Exceptions::ValidationFailed: Property track_interface must be one of: 
Array! You passed "eth1 weight 10"

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.