Determining which master an agent is connected to

66 views
Skip to first unread message

Daren Arnold

unread,
Dec 3, 2014, 10:25:36 AM12/3/14
to puppet...@googlegroups.com

Hello,

Newb question here.  I have inherited a PE 3.3 setup that uses a Puppet master hub, spoke and about 100 agents. The agents were installed at various times - some were connected directly to the hub and others connected to the spoke.

Is there a way to determine which agents are connected to the hub versus the spoke? I couldn’t find a fact that reflected the Puppet master.  Also, the console doesn’t seem to provide this information.

Thanks for any help you can provide.

Daren

Tony Thayer

unread,
Dec 3, 2014, 1:38:12 PM12/3/14
to puppet...@googlegroups.com
The agents should have the master defined in their puppet.conf file. Failing that, you can manually run the agent on a system with "puppet agent -t --debug" and look for entries that look like "Caching connection for https://puppet.local:8140"

- Tony

Daren Arnold

unread,
Dec 3, 2014, 2:20:58 PM12/3/14
to puppet...@googlegroups.com
Tony,

Thanks for your reply.  I was hoping to avoid inspecting all of the agents (either puppet.conf files or running puppet agent -t --debug) manually.  I am looking into an approach that involves creating an external fact to query the value of 'server' in the puppet.conf.  That may be what you were suggesting?  Either way, I'll post how that option goes.

-Daren

Tony Thayer

unread,
Dec 3, 2014, 2:35:38 PM12/3/14
to puppet...@googlegroups.com
If you already have SSH shared keys, a simpler method may be to just run a remote ssh command through a loop. For instance, if you have the hostnames in a text file named servers.txt, you could run something like
while read -u10 HOST ; do echo $HOST; ssh $HOST "grep server /etc/puppet/puppet.conf" ; done 10< servers.txt
- Tony

Ramin K

unread,
Dec 3, 2014, 2:40:14 PM12/3/14
to puppet...@googlegroups.com
There is already a set of server facts available during a Puppet run.

https://docs.puppetlabs.com/puppet/latest/reference/lang_facts_and_builtin_vars.html#puppet-master-variables

Because you're running PE you should be able to query which servers are
using which server through mcollective.

Ramin
> --
> You received this message because you are subscribed to the Google
> Groups "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to puppet-users...@googlegroups.com
> <mailto:puppet-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/770bda3a-3797-4469-8f07-ce68955b1d84%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/770bda3a-3797-4469-8f07-ce68955b1d84%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Daren Arnold

unread,
Dec 3, 2014, 4:25:20 PM12/3/14
to puppet...@googlegroups.com, ramin...@badapple.net
Hi Ramin,

Is this feature/variable turned on by default in PE 3.3?  I am unable to see a fact for 'servername'.  I am probably trying to access it incorrectly.  To test, I issue an mco command:

mco inventory <hostname>

I don't see servername available.

Thanks for any additional help you can provide.

Daren

Ramin K

unread,
Dec 3, 2014, 5:13:46 PM12/3/14
to puppet...@googlegroups.com
I'm not a PE user, but the config for the OSS version has a blacklist to
remove facts like uptime, path, ps, etc from the facts.yaml. I'd expect
PE to follow the same process. Might be worth opening a support request.

Ramin
> > an email to puppet-users...@googlegroups.com <javascript:>
> > <mailto:puppet-users...@googlegroups.com <javascript:>>.
> <https://groups.google.com/d/msgid/puppet-users/770bda3a-3797-4469-8f07-ce68955b1d84%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/optout>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to puppet-users...@googlegroups.com
> <mailto:puppet-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/c2ab756e-8404-4cfd-8099-a28c82c6cd71%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/c2ab756e-8404-4cfd-8099-a28c82c6cd71%40googlegroups.com?utm_medium=email&utm_source=footer>.

Wil Cooley

unread,
Dec 4, 2014, 12:21:51 AM12/4/14
to puppet-users group
The $servername variable isn't actually a fact -- it's set by the server itself while compiling the catalog, so from the perspective of writing manifests it smells a lot like a fact.

Wil

     > <mailto:puppet-users+unsub...@googlegroups.com <javascript:>>.

To view this discussion on the web visit
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/547F8B10.6010206%40badapple.net.
Reply all
Reply to author
Forward
0 new messages