Hi everyone. I'm running open source Puppet versio...
# puppet
n
Hi everyone. I'm running open source Puppet version 7. I'm using the roles/profiles architecture to manage my configurations. I'm using the puppetlabs/docker module to manage my compose files/services (docker_compose resource definitions) for various application stacks. One of my compose-based application stacks is an nginx reverse proxy for a number of FQDNs. I'm writing a custom module to manage certificates using lego. My lego module loops over a list of domains and uses exec resources to create/renew the certificates. I'm struggling to figure out how to declare the dependencies between my lego module certificate creation and/or renewal with restarting my nginx stack. I'm trying to keep the modules as loosely coupled as possible. I've tried creating File resources for the certificates within the loop and subscribing the nginx docker_compose resource to the certificate File resources. I am getting errors from the nginx docker_compose that the File resources do not exist, presumably because they are dynamically generated in the loop and haven't been actualized yet? I've thought that somehow declaring the dependencies within my profiles is a better approach, but I haven't been able to wrap my head around how to declare a dependency in a class external to both the File or Docker_compose resources. I'm looking for suggestions on the best way to approach this situation. Should I give up the idea of loosely coupling the module? Is there a way to subscribe to resources that are dynamically created within a loop in a different module?
k
Puppet 7 is dead, switch to OpenVox 8. I recommend using the Vox Pupuli nginx and letsencrypt modules, and running nginx natively instead of in a container. Works great.
n
Switching to OpenVox 8 is on the roadmap. Unfortunately due to dumb corporate policies I can't make that happen yet. I'll look into the voxpupuli modues. Do they handle the dependency of reloading nginx with cert renewals natively?
k
yes, you can either put a notify relationship into your code, or you can have it do a reload as a hook script like in this example: https://github.com/voxpupuli/puppet-letsencrypt?tab=readme-ov-file#cron-using-certbot-certonly