Skip to content

Instantly share code, notes, and snippets.

@marcothz
Last active September 28, 2023 13:29
Show Gist options
  • Save marcothz/2675f0371e730e63cffb71561a2336c0 to your computer and use it in GitHub Desktop.
Save marcothz/2675f0371e730e63cffb71561a2336c0 to your computer and use it in GitHub Desktop.
# This requires ruby, so you might need to do a . ~/.asdf/asdf.sh
# /opt/puppetlabs/pdk/share/cache/ruby/2.7.0/bin/r10k puppetfile install --moduledir=/etc/puppetlabs/code/environments/testing_dev_branch/modules
SOURCE=/home/<user>/git/puppet-modules
TARGET=/etc/puppetlabs/code/environments/testing_dev_branch
IGNORE=--exclude='.git/'
mkdir -p $TARGET/modules
while true
do
# We can't run this all the time, because it will also delete the modules.
# Which would make a full modules sync everytime.
# rsync -avh --delete --force --delete-excluded $IGNORE $SOURCE/control-repo/ $TARGET
rsync -avh $IGNORE $SOURCE/<git-repository-1>/ $TARGET/
rsync -avh $IGNORE $SOURCE/<git-repository-2>/ $TARGET/
sleep 2
done
@marcothz
Copy link
Author

This script can be used to sync the code from local Git repositories with the folder where the Puppet Server loads the code.
To install the Puppet Server in a VM, you can use these articles as a reference:

credits to @cgorshing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment