- From: <
>
- To:
- Subject: [chef] Configure server to integer mapping
- Date: Wed, 29 Oct 2014 19:50:55 -0700 (PDT)
Hi everyone,
For a few services like zookeeper or kafka, they require a server to integer
mapping like this,
server a - 1
server b - 2
...
This is particularly difficult to do in Chef (outside of manually configuring
this) using things like search. Some methods I have tried or seen,
1. Search for nodes and sort nodes by name. Use the index of each server as
their id. This can cause servers to use the same id for a moment if
provisioning servers concurrently. This can also cause problems if a new node
doesn't get appended to the end causing a number of servers to change their
ids.
2. Convert ipaddress or some other attribute into an integer. Unfortunately
this produces an integer too large as services like zookeeper only allow ids
between 0-255.
3. Set this id on the node during provisioning and track the current id
somewhere. Then you can use search to just get the mapping.
Does anyone have other suggestions? It seems like 3 is the best option though
not terrible easy to do. It could be easier than I think if I use something
like chef-metal and define each machine with an id.
Bryan
- [chef] Configure server to integer mapping, bjbq4d, 10/29/2014
Archive powered by MHonArc 2.6.16.