natemccurdy / puppet-purge_node

A Puppet Task to purge nodes
Apache License 2.0
5 stars 5 forks source link

Find a better way to detect a Puppet master #2

Closed natemccurdy closed 6 years ago

natemccurdy commented 6 years ago

The current logic to detect if the task is being run on a the primary master doesn't account for some edge cases. For example, when using SRV records and the value for server does not equal certname.

https://github.com/natemccurdy/puppet-purge_node/blob/1.2.0/tasks/init.rb#L14

Find a better way to figure this out.

natemccurdy commented 6 years ago

One possible way is to search /etc/puppetlabs/puppetserver/bootstrap.cfg for the certificate-authority-service line as that should only exist on the CA.

jacobmw commented 6 years ago

We also have this issue as we have HA enabled.

natemccurdy commented 6 years ago

@jacobmw If you have a moment, can you check if the solution from the detect_master branch works for you?

natemccurdy commented 6 years ago

Fixed in https://github.com/natemccurdy/puppet-purge_node/releases/tag/1.2.1