diff options
-rw-r--r-- | lib/hydra/deploy | 20 | ||||
-rwxr-xr-x | share/hydra/deploy | 19 | ||||
-rwxr-xr-x | share/hydractl/provision | 2 |
3 files changed, 21 insertions, 20 deletions
diff --git a/lib/hydra/deploy b/lib/hydra/deploy index 5c288a5..56c52b8 100644 --- a/lib/hydra/deploy +++ b/lib/hydra/deploy @@ -7,7 +7,6 @@ function hydra_deploy_setup { DEPLOY_DEPENDENCIES="puppet ruby-sqlite3 ruby-activerecord ruby-activerecord-deprecated-finders" DEPLOY_RSYNC="rsync -CrltDvpq --no-owner --exclude=/ssl --exclude=keys --exclude=site_keys --exclude=hiera/secrets --delete --rsync-path" RSYNC_PATH="rsync -q" - COPY_PATH="" if [ "$1" == "remote" ]; then # Deploy in a remote host @@ -19,7 +18,6 @@ function hydra_deploy_setup { DEPLOY_OPTS="$HYDRA_FOLDER/puppet/ $NODE:/etc/puppet/" DEPLOY_DEST="$FQDN:" RSYNC_PATH="sudo rsync -q" - COPY_PATH="$RSYNC_PATH" hydra_deploy_set_manifest else echo "No folder specified." @@ -31,19 +29,21 @@ function hydra_deploy_setup { FOLDER="$2" DEPLOY_BASE="/etc" DEPLOY_COMMAND="$SUDO chroot $FOLDER" + DEPLOY_RSYNC="$SUDO $DEPLOY_RSYNC" DEPLOY_OPTS="$HYDRA_FOLDER/puppet/ $FOLDER/etc/puppet/" DEPLOY_DEST="$FOLDER" - hydra_deploy_set_manifest - - if [ ! -d "$FOLDER"]; then - echo "folder not found: $FOLDER" - exit 1 - fi # Fix hostname if [ -s "$FOLDER/etc/hostname" ]; then FQDN="`cat $FOLDER/etc/hostname`" fi + + hydra_deploy_set_manifest + + if [ ! -d "$FOLDER" ]; then + echo "folder not found: $FOLDER" + exit 1 + fi else echo "No node specified." exit 1 @@ -62,12 +62,13 @@ function hydra_deploy_setup { DOMAIN="`echo $FQDN | cut -d . -f 2-`" ROLE="`hydra_yaml_param nodo::role $HYDRA_FOLDER/puppet/hiera/node/$FQDN.yaml`" LOCATION="`hydra_yaml_param nodo::location $HYDRA_FOLDER/puppet/hiera/node/$FQDN.yaml`" + ENV="LC_ALL=C" # Puppet command if [ -e "$HYDRA_FOLDER/puppet/bin/deploy" ]; then DEPLOY_PUPPET="$DEPLOY_BASE/puppet/bin/deploy" else - DEPLOY_PUPPET="LC_ALL=C puppet apply $PUPPET_OPTS $PUPPET_MANIFEST" + DEPLOY_PUPPET="$ENV puppet apply $PUPPET_OPTS $PUPPET_MANIFEST" fi # Deployment command @@ -142,6 +143,7 @@ function hydra_deploy_copy { local dest="$3" if [ "$location" == "folder" ]; then + $SUDO mkdir -p $dest $SUDO cp $orig $dest elif [ "$location" == "remote" ]; then $DEPLOY_RSYNC "$RSYNC_PATH" $orig $dest diff --git a/share/hydra/deploy b/share/hydra/deploy index 21eafd5..91437ec 100755 --- a/share/hydra/deploy +++ b/share/hydra/deploy @@ -41,15 +41,16 @@ echo '' for node in $NODES; do if [ -d "$node" ]; then echo "Deploying to $node folder..." - echo "" # Setup deploy environment + FOLDER=$node hydra_deploy_setup folder $FOLDER # Check if puppet is installed if [ ! -e "$FOLDER/usr/bin/puppet" ]; then echo "Installing dependencies..." - $DEPLOY_COMMAND apt-get install $DEPLOY_DEPENDENCIES -y + $DEPLOY_COMMAND aptitude update + $DEPLOY_COMMAND aptitude install $DEPLOY_DEPENDENCIES -y fi # Create folders @@ -61,29 +62,28 @@ for node in $NODES; do # Copy hiera configuration hydra_deploy_copy_secrets folder - echo "" # Run puppet, overriding FQDN echo "Applying configuration..." - FACTER_domain=$DOMAIN FACTER_hostname=$HOSTNAME FACTER_fqdn=$HOSTNAME.$DOMAIN $DEPLOY_APPLY + echo HOSTNAME=$FQDN FACTER_domain=$DOMAIN FACTER_hostname=$FQDN FACTER_fqdn=$HOSTNAME.$DOMAIN $DEPLOY_APPLY + exit elif [ "$node" == "localhost" ] || [ "$node" == "`facter fqdn`" ] || [ "$node" == "`facter hostname`" ]; then echo "Deploying to localhost..." - echo "" # Setup deploy environment hydra_deploy_setup # Check if puppet is installed - for dep in $DEPLOY_DEPENDENCIES; do - hydra_install_package $dep - done + if [ ! -e "/usr/bin/puppet" ]; then + $SUDO aptitude update + $SUDO aptitude install $DEPLOY_DEPENDENCIES -y + fi # Run puppet echo "Applying configuration..." $DEPLOY_APPLY else echo "Deploying to $node..." - echo "" # Setup deploy environment hydra_deploy_setup remote $node @@ -108,7 +108,6 @@ EOF # Copy hiera configuration hydra_deploy_copy_secrets remote - echo "" # Run puppet echo "Applying configuration..." diff --git a/share/hydractl/provision b/share/hydractl/provision index 087b703..94f69e0 100755 --- a/share/hydractl/provision +++ b/share/hydractl/provision @@ -94,7 +94,7 @@ function hydra_provision_config { hydra_user_config interactive y "Interactive mode? (y/n)" hydra_user_config device /dev/sdb "Destination device" - hydra_user_config root_size 20G "Size of root partition" + hydra_user_config root_size 20G "Size of root partition (-1 for all free space)" hydra_user_config swap_size 2000 "Swap size (in MB, 0 to not create it)" hydra_user_config home_size 20G "Size of home partition (0 to not create it, -1 for all free space)" hydra_user_config var_size 20G "Size of var partition (0 to not create it, -1 for all free space)" |