Skip to content

Instantly share code, notes, and snippets.

@gangsta
Created August 29, 2017 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gangsta/7b0ff2b918f142302aa1b06bc5210b9a to your computer and use it in GitHub Desktop.
Save gangsta/7b0ff2b918f142302aa1b06bc5210b9a to your computer and use it in GitHub Desktop.
Gogs and Puppet with Foreman

Execute shell

Command

#!/bin/bash

echo -e ""
echo -e "************************************************************************************************"
echo -e "Parsing Puppet Environment"
echo -e "************************************************************************************************"
echo -e ""

cd /opt/git/ && git clone gogs@mydomain.com:puppet/puppet-production.git production
if [ "$?" = "0" ]; then
        echo -e "INFO - Git Pull is successful"
else
        echo -e "ERROR - An error occurred while running Git Pull!"
        exit 1
fi
 

echo -e "INFO - Runnign Puppet-Lint..."
cd /opt/git/ && /usr/local/bin/puppet-lint production/
if [ "$?" = "0" ]; then
        echo -e "INFO - Puppet-Lint is successfully ended"
        rm /opt/git/production -rf
else
        echo -e "ERROR - An error occurred while running puppet-lint!"
        rm /opt/git/production -rf
        exit 1
fi


curl -k -u "$FUSER":"$FPASSWD" -H "Content-Type: application/json" -X POST https://foreman.mydomain.com/api/smart_proxies/1/import_puppetclasses

Execute shell script on remote host using ssh

SSH site	puppet@foreman.mydomain.com
	
Command	`cd /etc/puppetlabs/code/environments/production/; git pull && git submodule update --init`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment