Last active
May 29, 2018 22:32
-
-
Save natemccurdy/985823c2d0c9cc716c09ab07404831b9 to your computer and use it in GitHub Desktop.
Show nodes where certname and fqdn are not the same
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/puppetlabs/puppet/bin/ruby | |
# | |
# This script will find any Puppet agent whose certname does NOT match the agent's FQDN. | |
# | |
require 'json' | |
fqdn_values = JSON.parse(`/opt/puppetlabs/puppet/bin/puppet query 'facts[certname,value] { name = "fqdn" }'`) | |
fqdn_values.each do |result| | |
puts result['certname'] if result['certname'] != result['value'] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment