aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/todo.rst5
-rw-r--r--lib/hydra/deploy14
-rwxr-xr-xshare/hydra/deploy6
3 files changed, 22 insertions, 3 deletions
diff --git a/doc/todo.rst b/doc/todo.rst
index 7c23e48..c74f924 100644
--- a/doc/todo.rst
+++ b/doc/todo.rst
@@ -3,10 +3,9 @@ TODO
- init: version control in the superproject?
- metrics and alarms subsystem.
-- compile: known_hosts.
+- compile: sshkey.
- deploy:
- - fqdn match via local config lookup.
- - fact collection.
- lockfile.
+ - fqdn match via local config lookup.
- check hostname and required node configuration.
- log applied version and date (in the node and in the repo).
diff --git a/lib/hydra/deploy b/lib/hydra/deploy
index 748263c..7a8f2e3 100644
--- a/lib/hydra/deploy
+++ b/lib/hydra/deploy
@@ -15,6 +15,9 @@ function hydra_deploy_setup {
# Fix puppet folder permissions
chmod 700 $HYDRA_FOLDER/puppet
+ # Ensure facts folder
+ mkdir -p $HYDRA_FOLDER/puppet/config/facts
+
if [ "$1" == "remote" ]; then
# Deploy in a remote host
if [ ! -z "$2" ]; then
@@ -196,3 +199,14 @@ function hydra_deploy_copy {
$DEPLOY_RSYNC "$RSYNC_PATH" $orig $dest
fi
}
+
+# Collects facts from a system
+function hydra_deploy_facts_collect {
+ echo "Collecting facts from remote system..."
+
+ if [ "$1" == "local" ]; then
+ facter --yaml > $HYDRA_FOLDER/puppet/config/facts/$FQDN.yaml
+ elif [ "$1" == "remote" ]; then
+ $HYDRA_CONNECT $FQDN facter --yaml > $HYDRA_FOLDER/puppet/config/facts/$FQDN.yaml
+ fi
+}
diff --git a/share/hydra/deploy b/share/hydra/deploy
index f8dbb08..f491e70 100755
--- a/share/hydra/deploy
+++ b/share/hydra/deploy
@@ -89,6 +89,9 @@ for node in $NODES; do
$SUDO apt-get install $DEPLOY_DEPENDENCIES -y
fi
+ # Collect facts
+ hydra_deploy_facts_collect local
+
# Run puppet
echo "Applying configuration..."
$DEPLOY_APPLY
@@ -112,6 +115,9 @@ EOF
# Create folders
hydra_deploy_mkdirs
+ # Collect facts
+ hydra_deploy_facts_collect remote
+
# Sync repository to server
echo "Syncing configuration..."
$DEPLOY_RSYNC "$RSYNC_PATH" $DEPLOY_OPTS