Guest User

Untitled

a guest
Sep 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #!/bin/sh
  2. # File: GITOLITE_DIR/repositories/puppet.git/hooks/post-receive
  3.  
  4. puppetsync()
  5. {
  6. ssh $SSH_ARGS "$PUPPETMASTER" "$SYNC_COMMAND" \
  7. --branch "$BRANCH" \
  8. --repository "$REPO" \
  9. --deploy "$DEPLOY" \
  10. $DELETE
  11. }
  12.  
  13. set_common()
  14. {
  15. REPO="git@GITOLITE:puppet.git"
  16. SYNC_COMMAND="/usr/local/bin/puppetsync"
  17. SSH_ARGS="-i $HOME/git/.ssh/git@GITOLITE"
  18. }
  19. set_puppetmaster(){
  20. DEPLOY="/usr/local/etc/puppet/environments"
  21. PUPPETMASTER="puppet@PUPPETMASTER"
  22. }
  23. set_otherpuppetmaster(){
  24. DEPLOY="/usr/local/etc/puppet/environments"
  25. PUPPETMASTER="puppet@PUPPETMASTER"
  26. }
  27. set_commonwhile read oldrev newrev refname; do BRANCH=`echo $refname | sed -n 's/^refs\/heads\///p'`
  28. [ "$newrev" -eq 0 ] 2> /dev/null && DELETE='--delete' || DELETE=''
  29.  
  30. set_puppetmaster; puppetsync
  31. #set_otherpuppetmaster; puppetsync
  32.  
  33.  
  34. done
Add Comment
Please, Sign In to add comment