generate /etc/puppet/cosmos-modules.conf dynamically

This commit is contained in:
Fredrik Thulin 2023-01-19 17:15:37 +01:00
parent 187e3bc9be
commit e2e394a9af
No known key found for this signature in database
GPG key ID: 2707330D4030CCAD
3 changed files with 44 additions and 43 deletions

View file

@ -1,36 +0,0 @@
#
# name source (puppetlabs fq name or git url) upgrade (yes/no) tag-pattern
#
# NOTE that Git packages MUST be tagged with signatures by someone
# in the Cosmos trust list. That is why all the URLs point to forked
# versions in the SUNET github organization.
#
concat https://github.com/SUNET/puppetlabs-concat.git yes sunet-*
stdlib https://github.com/SUNET/puppetlabs-stdlib.git yes sunet-*
cosmos https://github.com/SUNET/puppet-cosmos.git yes sunet-*
ufw https://github.com/SUNET/puppet-module-ufw.git yes sunet_dev-*
apt https://github.com/SUNET/puppetlabs-apt.git yes sunet_dev-*
vcsrepo https://github.com/SUNET/puppetlabs-vcsrepo.git yes sunet-*
xinetd https://github.com/SUNET/puppetlabs-xinetd.git yes sunet-*
hiera-gpg https://github.com/SUNET/hiera-gpg.git yes sunet-*
#
# Alternate sources you might or might not want to use:
#concat puppetlabs/concat no
#stdlib puppetlabs/stdlib no
#ufw attachmentgenie/ufw no
#apt puppetlabs/apt no
#vcsrepo puppetlabs/vcsrepo no
#xinetd puppetlabs/xinetd no
#cosmos https://github.com/SUNET/puppet-cosmos.git yes
#python https://github.com/SUNET/puppet-python.git yes sunet-*
#erlang https://github.com/SUNET/garethr-erlang.git yes sunet-*
#rabbitmq https://github.com/SUNET/puppetlabs-rabbitmq.git yes sunet_dev-*
#pound https://github.com/SUNET/puppet-pound.git yes sunet_dev-*
#augeas https://github.com/SUNET/puppet-augeas.git yes sunet-*
#bastion https://github.com/SUNET/puppet-bastion.git yes sunet-*
#postgresql https://github.com/SUNET/puppetlabs-postgresql.git yes sunet_dev-*
#munin https://github.com/SUNET/ssm-munin.git yes sunet-*
#nagios https://github.com/SUNET/puppet-nagios.git yes sunet-*
#staging https://github.com/SUNET/puppet-staging.git yes sunet-*
#apparmor https://github.com/SUNET/puppet-apparmor.git yes sunet-*
#docker https://github.com/SUNET/garethr-docker.git yes sunet_dev-*

View file

@ -11,9 +11,9 @@ Exec {
#include cosmos::ntp
#include cosmos::rngtools
#include cosmos::preseed
include ufw
include apt
include cosmos
#include ufw
#include apt
#include cosmos
# you need a default node
@ -49,4 +49,3 @@ node default {
# proto => "tcp"
# }
#}

View file

@ -0,0 +1,38 @@
#!/bin/sh
#
# Dynamically configure /etc/puppet/cosmos-modules.conf
#
# The content of that file is chosen according to:
#
# 1. If the file is actually present in the model, use that.
# 2. If there is a script called /etc/puppet/setup_cosmos_models, run that.
# 3. If the file still doesn't exist, create it with the defaults in this script.
#
set -e
if [ -f "${COSMOS_MODEL}/overlay/etc/puppet/cosmos-modules.conf" ]; then
test "$COSMOS_VERBOSE" = "y" && \
echo "$0: /etc/puppet/cosmos-modules.conf is present in the model, exiting"
exit 0
fi
if [ -x /etc/puppet/setup_cosmos_models ]; then
test "$COSMOS_VERBOSE" = "y" && \
echo "$0: Updating /etc/puppet/cosmos-modules.conf with /etc/puppet/setup_cosmos_models"
/etc/puppet/setup_cosmos_models
test -f /etc/puppet/cosmos-modules.conf && exit 0
fi
test "$COSMOS_VERBOSE" = "y" && \
echo "$0: Creating/updating /etc/puppet/cosmos-modules.conf with defaults from this script"
cat > /etc/puppet/cosmos-modules.conf << EOF
# File created/updated by $0
#
concat puppetlabs/concat yes
stdlib puppetlabs/stdlib yes
#ufw attachmentgenie/ufw yes
#apt puppetlabs/apt yes
EOF