git.lirion.de

Of git, get, and gud

summaryrefslogtreecommitdiffstats
path: root/site/puppetdb_hostname_function
diff options
context:
space:
mode:
Diffstat (limited to 'site/puppetdb_hostname_function')
-rw-r--r--site/puppetdb_hostname_function/lib/puppet/parser/functions/puppetdb_hostname.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/site/puppetdb_hostname_function/lib/puppet/parser/functions/puppetdb_hostname.rb b/site/puppetdb_hostname_function/lib/puppet/parser/functions/puppetdb_hostname.rb
new file mode 100644
index 0000000..b43365f
--- /dev/null
+++ b/site/puppetdb_hostname_function/lib/puppet/parser/functions/puppetdb_hostname.rb
@@ -0,0 +1,12 @@
+require 'puppet/util/puppetdb'
+
+module Puppet::Parser::Functions
+ newfunction(:puppetdb_hostnames, :type => :rvalue) do |args|
+ output = []
+ Puppet::Util::Puppetdb.config.server_urls.each do | server_url |
+ output << server_url.hostname
+ end
+
+ output
+ end
+end