A cookook for using keepalived in EC2-VPC environment
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
attributes
recipes
templates/default
CHANGELOG.md
README.md
metadata.rb

README.md

keepalived-ec2 Cookbook

A cookook for using keepalived in EC2-VPC environment.

Requirements

AWS Access Key

ec2:DescribeInstances
ec2:DescribeNetworkInterfaces
ec2:AttachNetworkInterface
ec2:DetachNetworkInterface

Platforms

  • Amazon Linux

Chef

  • Chef 12.0 or later

Cookbooks

  • keepalived - keepalived-ec2 needs keepalived cookook.

Attributes

TODO: List your cookbook attributes here.

e.g.

keepalived-ec2::default

Key Type Description Default
['keepalived-ec2']['bag_name'] String bag_name
['keepalived-ec2']['item_name'] String item_name
['keepalived-ec2']['virtual_router_id'] String virtual_router_id 51
['keepalived-ec2']['chk_script'] String vrrp_script pidof haproxy
['keepalived-ec2']['eni'] String ENI ID to change in case of failover
['keepalived-ec2']['device_index'] String Number of eth#{n} you want to set ENI
['keepalived-ec2']['master_ip'] String MASTER's IP address
['keepalived-ec2']['backup_ip'] String BACKUP's IP address
['keepalived-ec2']['interface'] String Interface of NIC with my IP
['keepalived-ec2']['state'] String MASTER or BACKUP
['keepalived-ec2']['conf_template'] String The source template to use when creating the keepalived.conf. default.conf.erb

Usage

Create a Data Bag

{
  "id": "item_name"
  "AWS_ACCESS_KEY_ID": "XXXXXXXXXXXXXXXXXXXX",
  "AWS_SECRET_ACCESS_KEY": "XXXXXXXXXXXXXXXXXXXX"
  "AWS_REGION": "XXXXXXXXXXXXXXXXXXXX"
}

keepalived-ec2::default

MASTER

{
  "name":"master_node",
  "run_list": [
    "recipe[keepalived-ec2]"
  ],
  "keepalived-ec2" :{
    "bag_name": "bag_name",
    "item_name": "item_name",
    "chk_script": "pidof haproxy",
    "eni": "eni-xxxxxxxx",
    "device_index": "2",
    "interface": "eth1",
    "state": "MASTER",
    "virtual_router_id": "51",
    "master_ip": "10.0.0.110",
    "backup_ip": "10.0.0.210"
  },
}

BACKUP

{
  "name":"backup_node",
  "run_list": [
    "recipe[keepalived-ec2]"
  ],
  "keepalived-ec2" :{
    "bag_name": "bag_name",
    "item_name": "item_name",
    "chk_script": "pidof haproxy",
    "eni": "eni-xxxxxxxx",
    "device_index": "2",
    "interface": "eth1",
    "state": "BACKUP",
    "virtual_router_id": "51",
    "master_ip": "10.0.0.110",
    "backup_ip": "10.0.0.210"
  },
}

Contributing

TODO: (optional) If this is a public cookbook, detail the process for contributing. If this is a private cookbook, remove this section.

e.g.

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write your change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

License and Authors

Authors: cohalz