hi. i’m trying to figure out how i can inform my monitored clients of
their monitoring server’s IP for their config, especially when that
IP changes due to relaunching the mon server.
the answer might be to use databags. i note today’s thread
"[chef] passing attributes to recipes". but lemme talk it out:
at the moment, i supply a default attr mon_srv_ips in an environment
(i could also do this in role[base]). my clients’ grab that IP attr
and put it into their config via a template:
monserver=<%= node.mon.mon_srv_ips.join(’,’) %>
one day i’ll relaunch the mon server, it’ll get a new IP, and i’ll have
to update the attr by hand (i think) in the environment file or
role[base].
but what if that new mon server could populate that IP attr with its
IP when it comes up? i can write the mon server recipe to write the IP
to a databag. then the clients could pull that from the databag, rather
than the env or role[base].
is using a databag for this the right thing? is there some other (better?)
way for this mon server to push an attr into something that is visible
by all my clients? can a node push attrs to and environment or role?
hi. i'm trying to figure out how i can inform my monitored clients of
their monitoring server's IP for their config, especially when that
IP changes due to relaunching the mon server.
the answer might be to use databags. i note today's thread
"[chef] passing attributes to recipes". but lemme talk it out:
at the moment, i supply a default attr mon_srv_ips in an environment
(i could also do this in role[base]). my clients' grab that IP attr
and put it into their config via a template:
monserver=<%= node.mon.mon_srv_ips.join(',') %>
one day i'll relaunch the mon server, it'll get a new IP, and i'll have
to update the attr by hand (i think) in the environment file or
role[base].
but what if that new mon server could populate that IP attr with its
IP when it comes up? i can write the mon server recipe to write the IP
to a databag. then the clients could pull that from the databag, rather
than the env or role[base].
is using a databag for this the right thing? is there some other (better?)
way for this mon server to push an attr into something that is visible
by all my clients? can a node push attrs to and environment or role?
but, the attr for which the clients would search, how would i populate
that attr in the first place? and how would i update that attr
automatically when a mon server's IP changes? that's what i don't get.
oh wait.. i think i just got it. a new mon server updates its own node's
attributes. but those attributes are searchable from all nodes. is
that it?
hi. i'm trying to figure out how i can inform my monitored clients of
their monitoring server's IP for their config, especially when that
IP changes due to relaunching the mon server.
the answer might be to use databags. i note today's thread
"[chef] passing attributes to recipes". but lemme talk it out:
at the moment, i supply a default attr mon_srv_ips in an environment
(i could also do this in role[base]). my clients' grab that IP attr
and put it into their config via a template:
monserver=<%= node.mon.mon_srv_ips.join(',') %>
one day i'll relaunch the mon server, it'll get a new IP, and i'll have
to update the attr by hand (i think) in the environment file or
role[base].
but what if that new mon server could populate that IP attr with its
IP when it comes up? i can write the mon server recipe to write the IP
to a databag. then the clients could pull that from the databag, rather
than the env or role[base].
is using a databag for this the right thing? is there some other (better?)
way for this mon server to push an attr into something that is visible
by all my clients? can a node push attrs to and environment or role?
but, the attr for which the clients would search, how would i populate
that attr in the first place? and how would i update that attr
automatically when a mon server's IP changes? that's what i don't get.
oh wait.. i think i just got it. a new mon server updates its own node's
attributes. but those attributes are searchable from all nodes. is
that it?
Correct. The code will look something like
mon_server_ip = nil
search(:node, 'roles:mo_server') do |n|
mon_server_ip = n['ipaddress']
end