# the base class defining tings common for all three static classes (master, mirror, source)
class roles::static::base {
+ $query = 'nodes[certname] { resources { type = "Class" and title = "Roles::Static_mirror" } }'
+ $static_mirrors = sort(puppetdb_query($query).map |$value| { $value["certname"] })
+
file { '/etc/static-components.conf':
content => template('roles/static-mirroring/static-components.conf.erb'),
}
lines << "# This file has been autogenerated and pushed by puppet. Edit static-components.yaml in puppet."
lines << "# <master> <service> <source host> <directory> <extra push hosts, comma separated> <hosts to not mirror this component to>"
+# this is the list of static mirrors, or, technically, the list of
+# nodes with the roles::static_mirror class applied to it. this should
+# be populated from outside the template from PuppetDB, see:
+# modules/roles/manifests/static_base.pp
+mirrors = @static_mirrors
config = YAML.load(File.open('/etc/puppet/modules/roles/misc/static-components.yaml').read)
-mirrors = scope.lookupvar('site::roles')['static_mirror']
+
config['mirrors'].each do |mirror, mc|
if not mirrors.include?(mirror)