agent needs to get info from another agent (dependency)

31 views
Skip to first unread message

Sai Kothapalle

unread,
Aug 22, 2014, 1:13:52 PM8/22/14
to puppet...@googlegroups.com
Hi,

 Here is my unique case. I have a speech search application for which the standard installation is to install the application components on 3 nodes or agents. The components have the following depency

  •  Agent 1 needs hostname of agent 2 and agent 3 which is written into a config file
  •  Agent 2 and Agent 3 need the private IP address of Agent 1 to be written into a config file which it uses while starting up the service.
I am able to install the packages using puppet and load the config files using erb templates. However, I am unsure of how to go about the dependency between agents. Did lookup Exported resources but while the syntax gives an option to export a type, how do I export IP address etc. is there a better option> Thanks for the help


Felix Frank

unread,
Aug 25, 2014, 9:29:59 PM8/25/14
to puppet...@googlegroups.com
Hi,

yes, you will need exported resources, and it won't be an easy design at all.

I imagine it would work roughly like this (assuming Agent 1 runs central_server and Agents 2 and 3 run slave_server instances).

Sketch of the manifest for the central server:

class central_server {
    concat { '/etc/server_config': ... }
    Central_server_snippet<<| tag == 'this-cluster' |>>
}

define central_server_snippet($slave_name) {
    concat::fragment { "central-server-$name":
      target => '/etc/server_config',
      content => "something-with $slave_name\n";
    }
    @@slave_server_snippet { "for-$name": content => "something-with $ipaddress" }
}

The slave servers do:

class slave_server {
    @@central_server_snippet { "$fqdn": slave_name => "$hostname" }
    Slave_server_snippet<<| title == "for-$fqdn" |>>
}

The idea being that the central server will not export its settings to the slaves before they have exported their respective names to him.

Untested and incomplete. YMMV.

Cheers,
Felix
Reply all
Reply to author
Forward
0 new messages