Something like this in $template.erb:
<VirtualHost <%= ip %>:443>
Document Root <%= docroot %>
SSLCertificateFile <%= cert %>
# ...
</VirtualHost>
That is, any variable in puppet is available as a local variable in the ruby bits hiding in the .erb file.
Not sure why you have "$template" instead of a named .erb file (not seeing $template set anywhere, but willing to assume it's hiding somewhere)
And this seems wrong: cert => Openssl::Cert["rri"]
. I'd expect something more like:
openssl::cert { "rri": }
And then the .erb would be more like:
<VirtualHost <%= ip %>:443>
Document Root <%= docroot %>
SSLCertificateFile <%= certDirectory %>/<%= name %>
# ...
</VirtualHost>
The main thing you are after, "notify all the services that are subscribed to /etc/nova/nova.conf", doesn't seem to be possible with file
-resources. But, it works with exec
-resources, with refreshonly
-parameter. (Just tested similar configuration with Puppet 2.7.11). You must add a dummy exec
-resource:
exec {'dummy-nova-refresh':
command => "/bin/true",
refreshonly => true,
}
When the command is run, exec
sends notification to all its subscribers. And refreshonly
-parameter makes sure that command is run only on refresh.
Subscribe all services to this Exec:
service { 'openstack-nova-network':
ensure => running,
enable => true,
subscribe => Exec['dummy-nova-refresh'],
}
And use notify from all file-resources. (Do this also for /etc/nova/nova.conf
, or specify it in the subscribe list for each service
):
file { '/path/to/some/file':
source => 'puppet:///.../',
notify => Exec['dummy-nova-refresh'],
}
And done. A change in any file triggers a refresh in all services subscribed to 'dummy-nova-refresh'
.
Best Answer
Link to documentation
so..