applypuppet.txt 940 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. debug=false
  3. puppetcolor='--color false'
  4. usage() {
  5. echo -e "Usage: applypuppet\n" >&2
  6. echo -e " Options:" >&2
  7. echo -e " -v, --verbose Print verbose debug messages\n" >&2
  8. exit 1
  9. }
  10. TEMP=$(getopt -o vc --long verbose,color -- "$@")
  11. if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
  12. eval set -- "$TEMP"
  13. while true ; do
  14. case "$1" in
  15. -v|--verbose) debug=true; puppetdebug='--verbose --debug'; shift ;;
  16. -c|--color) puppetcolor='--color true'; shift ;;
  17. --) shift; break ;;
  18. *) echo "Unknown parameter"; exit 1 ;;
  19. esac
  20. done
  21. $debug && echo "Debug mode is on"
  22. mkdir -p /tmp/puppet
  23. wget --quiet https://notabug.org/MarcusMoeller/installbox/raw/master/puppet.tar.gz -O /tmp/puppet/puppet.tar.gz
  24. tar xzf /tmp/puppet/puppet.tar.gz -C /tmp/puppet/
  25. puppet apply /tmp/puppet/site.pp --modulepath=/tmp/puppet/modules $puppetdebug $puppetcolor
  26. rm -rf /tmp/puppet/