# Common parameters
# Exclude eventual keys and version control files
DEPLOY_DEPENDENCIES="puppet-common ruby-sqlite3 ruby-activerecord ruby-activerecord-deprecated-finders augeas-tools"
- DEPLOY_RSYNC="rsync -CrltDvpq --no-owner --exclude=/ssl --exclude=keys --exclude=site_keys --exclude=hiera/secrets --delete --rsync-path"
+ DEPLOY_RSYNC="rsync -CrltDvpq --no-owner --exclude=/ssl --exclude=keys --exclude=site_keys --exclude=config/secrets --delete --rsync-path"
RSYNC_PATH="rsync -q"
if [ "$1" == "remote" ]; then
# Common parameters
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`"
+ ROLE="`hydra_yaml_param nodo::role $HYDRA_FOLDER/puppet/config/node/$FQDN.yaml`"
+ LOCATION="`hydra_yaml_param nodo::location $HYDRA_FOLDER/puppet/config/node/$FQDN.yaml`"
# Puppet command
if [ -e "$HYDRA_FOLDER/puppet/bin/deploy" ]; then
$DEPLOY_COMMAND chmod -R 640 /etc/puppet
}
-# Copy hiera secrets
+# Copy config secrets
function hydra_deploy_copy_secrets {
local location="$1"
location="remote"
fi
- $DEPLOY_COMMAND mkdir -p $FOLDER/etc/puppet/hiera/secrets/{domain,location,node,role}
+ $DEPLOY_COMMAND mkdir -p $FOLDER/etc/puppet/config/secrets/{domain,location,node,role}
- if [ ! -z "$DOMAIN" ] && [ -e "$HYDRA_FOLDER/puppet/hiera/secrets/domain/$DOMAIN.yaml" ]; then
- hydra_deploy_copy $location $HYDRA_FOLDER/puppet/hiera/secrets/domain/$DOMAIN.yaml $DEPLOY_DEST/etc/puppet/hiera/secrets/domain/
+ if [ ! -z "$DOMAIN" ] && [ -e "$HYDRA_FOLDER/puppet/config/secrets/domain/$DOMAIN.yaml" ]; then
+ hydra_deploy_copy $location $HYDRA_FOLDER/puppet/config/secrets/domain/$DOMAIN.yaml $DEPLOY_DEST/etc/puppet/config/secrets/domain/
fi
- if [ ! -z "$LOCATION" ] && [ -e "$HYDRA_FOLDER/puppet/hiera/secrets/location/$LOCATION.yaml" ]; then
- hydra_deploy_copy $location $HYDRA_FOLDER/puppet/hiera/secrets/location/$LOCATION.yaml $DEPLOY_DEST/etc/puppet/hiera/secrets/location/
+ if [ ! -z "$LOCATION" ] && [ -e "$HYDRA_FOLDER/puppet/config/secrets/location/$LOCATION.yaml" ]; then
+ hydra_deploy_copy $location $HYDRA_FOLDER/puppet/config/secrets/location/$LOCATION.yaml $DEPLOY_DEST/etc/puppet/config/secrets/location/
fi
- if [ ! -z "$ROLE" ] && [ -e "$HYDRA_FOLDER/puppet/hiera/secrets/role/$ROLE.yaml" ]; then
- hydra_deploy_copy $location $HYDRA_FOLDER/puppet/hiera/secrets/role/$ROLE.yaml $DEPLOY_DEST/etc/puppet/hiera/secrets/role/
+ if [ ! -z "$ROLE" ] && [ -e "$HYDRA_FOLDER/puppet/config/secrets/role/$ROLE.yaml" ]; then
+ hydra_deploy_copy $location $HYDRA_FOLDER/puppet/config/secrets/role/$ROLE.yaml $DEPLOY_DEST/etc/puppet/config/secrets/role/
fi
- if [ ! -z "$FQDN" ] && [ -e "$HYDRA_FOLDER/puppet/hiera/secrets/node/$FQDN.yaml" ]; then
- hydra_deploy_copy $location $HYDRA_FOLDER/puppet/hiera/secrets/node/$FQDN.yaml $DEPLOY_DEST/etc/puppet/hiera/secrets/node/
+ if [ ! -z "$FQDN" ] && [ -e "$HYDRA_FOLDER/puppet/config/secrets/node/$FQDN.yaml" ]; then
+ hydra_deploy_copy $location $HYDRA_FOLDER/puppet/config/secrets/node/$FQDN.yaml $DEPLOY_DEST/etc/puppet/config/secrets/node/
fi
}
echo "Syncing configuration..."
$DEPLOY_RSYNC "$RSYNC_PATH" $DEPLOY_OPTS
- # Copy hiera configuration
+ # Copy config configuration
hydra_deploy_copy_secrets folder
# Run puppet, overriding FQDN
echo "Syncing configuration..."
$DEPLOY_RSYNC "$RSYNC_PATH" $DEPLOY_OPTS
- # Copy hiera configuration
+ # Copy configuration
hydra_deploy_copy_secrets remote
# Run puppet
elif [ ! -e "$HYDRA_FOLDER/config/domain" ]; then
echo "fatal: please configure your domain at $HYDRA_FOLDER/config/domain"
exit 1
-elif [ -e "$HYDRA_FOLDER/puppet/hiera/node/$NODE.yaml" ]; then
+elif [ -e "$HYDRA_FOLDER/puppet/config/node/$NODE.yaml" ]; then
echo "fatal: node $NODE already defined"
exit 1
fi
#fi
# Copy YAML template
-mkdir -p $HYDRA_FOLDER/puppet/hiera/node
-cp $YAML $HYDRA_FOLDER/puppet/hiera/node/$NODE.yaml
+mkdir -p $HYDRA_FOLDER/puppet/config/node
+cp $YAML $HYDRA_FOLDER/puppet/config/node/$NODE.yaml
# Setup secret YAML template
-mkdir -p $HYDRA_FOLDER/puppet/hiera/secrets/node
-echo "---" > $HYDRA_FOLDER/puppet/hiera/secrets/node/$NODE.yaml
+mkdir -p $HYDRA_FOLDER/puppet/config/secrets/node
+echo "---" > $HYDRA_FOLDER/puppet/config/secrets/node/$NODE.yaml
# Copy node template
#mkdir -p $HYDRA_FOLDER/puppet/manifests/nodes
# Add to git
(
cd $HYDRA_FOLDER/puppet
- git add manifests/nodes/$NODE.pp hiera/node/$NODE.yaml hiera/secrets/node/$NODE.yaml
+ git add manifests/nodes/$NODE.pp config/node/$NODE.yaml config/secrets/node/$NODE.yaml
#if [ -e 'manifests/site.pp' ]; then
# git add manifests/site.pp
# Get a list of puppet node files
function hydra_node_files {
- if [ -d "$PUPPET/hiera/node/" ]; then
- FILES="$PUPPET/hiera/node/*"
+ if [ -d "$PUPPET/config/node/" ]; then
+ FILES="$PUPPET/config/node/*"
fi
}
# Get nodes
if [ ! -z "$CLASS" ]; then
hydra_nodes | while read node; do
- find $PUPPET/hiera -name "$node.yaml"
+ find $PUPPET/config -name "$node.yaml"
done | while read candidate; do
if grep -e "$CLASS" $candidate | grep -qe "^nodo::role"; then
basename $candidate .yaml
echo ""
# Is it a node?
-if [ -e "$PUPPET/hiera/node/$LAYER.$DOMAIN.yaml" ]; then
- echo "Defined as a node at hiera/node/$LAYER.$DOMAIN.yaml"
+if [ -e "$PUPPET/config/node/$LAYER.$DOMAIN.yaml" ]; then
+ echo "Defined as a node at config/node/$LAYER.$DOMAIN.yaml"
echo "Configuration:"
echo ""
- grep "nodo::role:" $PUPPET/hiera/node/$LAYER.$DOMAIN.yaml
- grep "nodo::location:" $PUPPET/hiera/node/$LAYER.$DOMAIN.yaml
+ grep "nodo::role:" $PUPPET/config/node/$LAYER.$DOMAIN.yaml
+ grep "nodo::location:" $PUPPET/config/node/$LAYER.$DOMAIN.yaml
fi
# DNS config