]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blobdiff - bin/install_script.sh
Fetch node informations from LDAP
[perso/Immae/Projets/Puppet.git] / bin / install_script.sh
index 49a737fde8fe4d38ff9b61eef6858b1384558aea..6b1aa39cc2d9a0153f666894f75df17155a41603 100755 (executable)
@@ -12,6 +12,7 @@ cat <<EOF
   --no-reboot-start       Don't reboot to rescue at the beginning
   --no-reboot-end         Don't reboot to normal at the end
   --git-branch            Use another puppet branch (default: master)
+  --environment           Environment to use for the installl (default: production)
 EOF
 }
 
@@ -19,6 +20,7 @@ set -e
 
 host_user=root
 git_branch=master
+environment=production
 
 while [ -n "$1" ]; do
   case "$1" in
@@ -50,6 +52,10 @@ while [ -n "$1" ]; do
       git_branch="$2"
       shift
       ;;
+    --environment)
+      environment="$2"
+      shift
+      ;;
     --help|-h)
       usage
       exit 0
@@ -173,9 +179,9 @@ cat > $ARCH_INSTALL_SCRIPT <<EOF
 CODE_PATH="/etc/puppetlabs/code"
 rm -rf \$CODE_PATH
 git clone -b $git_branch --recursive https://git.immae.eu/perso/Immae/Projets/Puppet.git \$CODE_PATH
-puppet apply --tags base_installation --test \$CODE_PATH/manifests/site.pp
+puppet apply --environment $environment --tags base_installation --test \$CODE_PATH/manifests/site.pp
 # The password seed requires puppet to be run twice
-puppet apply --tags base_installation --test \$CODE_PATH/manifests/site.pp
+puppet apply --environment $environment --tags base_installation --test \$CODE_PATH/manifests/site.pp
 EOF
 
 chmod a+x $ARCH_HOST_SCRIPT $ARCH_CHROOT_SCRIPT $ARCH_INSTALL_SCRIPT
@@ -197,7 +203,7 @@ read -p "Press key when LDAP is configured" i
 
 cat > $ARCH_PUPPET_CONFIGURATION_SCRIPT <<EOF
 CODE_PATH="/etc/puppetlabs/code"
-puppet apply --tags base_installation --test \$CODE_PATH/manifests/site.pp
+puppet apply --environment $environment --tags base_installation --test \$CODE_PATH/manifests/site.pp
 EOF
 
 cat > $ARCH_HOST_PUPPET_CONFIGURATION_SCRIPT <<EOF