Skip to content
This repository has been archived by the owner on Oct 27, 2024. It is now read-only.

Use data bags in Chef to manage specific application port reservations

License

Notifications You must be signed in to change notification settings

livinginthepast/port_reservations

Repository files navigation

port_reservations

Use data bags in Chef to manage specific application port reservations.

Usage

Data bag

Create a json file for your port reservations.

mkdir -p data_bags/ports
touch data_bags/ports/reservations.json
{
  "id": "reservations",
  "mapping": {
    "my-app": 8000,
    "haproxy-for-my-app": 8001
  }
}

In order to reserve a range of ports, strings can be used:

{
  "id": "reservations",
  "mapping": {
    "my-app": 8000,
    "haproxy-for-my-app": 8001
    "redii": "30000..30012"
  }
}

Note that when in this case, a range is returned by the included helpers.

Helpers

In a recipe, you can use the PortReservation helper to retrieve a specific port.

include_recipe 'port_reservations'

PortReservation.for('my-app') == 8000
PortReservation.for('redii') == 30000..30012

About

Use data bags in Chef to manage specific application port reservations

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages