Skip to content

Commit

Permalink
Craigs-MacBook-Pro.local
Browse files Browse the repository at this point in the history
  • Loading branch information
craigcomstock committed Apr 25, 2024
1 parent d1302c6 commit d35b9ac
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
24 changes: 21 additions & 3 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@ cf-remote sudo -H server cfe
cf-remote install --edition community --clients clients --bootstrap 192.168.56.20

wait "play around for a bit, setup the secret with cf-secret. press enter to pull, commit and push the secret to the repo..."
# cf-secret encrypt -H 192.168.56.10,192.168.56.7,192.168.56.20 -o /home/vagrant/secret.dat -
ssh ubuntu-20 sudo chown vagrant /home/vagrant/secret.dat
scp ubuntu-20:secret.dat simple/
git add simple/secret.dat
git commit -m 'updated secret'
git push

cf-remote sudo -H server,clients "/var/cfengine/bin/cf-agent -K"
cf-remote sudo -H server "/var/cfengine/bin/cf-agent -K"
cf-remote sudo -H clients "/var/cfengine/bin/cf-agent -K"

wait "install enterprise hub on ubuntu-22..."
cf-remote install --hub hub --bootstrap 192.168.56.22
Expand All @@ -62,6 +61,25 @@ cf-remote uninstall -H clients
cf-remote install --clients clients --bootstrap 192.168.56.22
cf-remote sudo -H clients cfe

wait "install enterprise hub on ubuntu-22..."
cf-remote install --hub hub --bootstrap 192.168.56.22

echo "https://192.168.56.22/settings/vcs enter VCS type: GIT+CFBS, URL: https://github.com/craigcomstock/play-cfbs and refspec: simple"
echo "add class to hub in MP UI: default:cfengine_internal_masterfiles_update"
wait "login to mission portal and setup VCS..."
cf-remote scp -H hub cfe
cf-remote sudo -H hub "cp /home/vagrant/cfe /usr/bin/cfe; chmod +x /usr/bin/cfe"
cf-remote sudo -H hub cfe

wait "re-encrypt secret for enterprise hub and clients..."
ssh ubuntu-22 sudo chown vagrant /home/vagrant/secret.dat
scp ubuntu-22:secret.dat simple/
git add simple/secret.dat
git commit -m 'updated secret'
git push
cf-remote sudo -H hub "/var/cfengine/bin/cf-agent -K"
cf-remote sudo -H clients "/var/cfengine/bin/cf-agent -K"

# debugging
cf-remote sudo -H hub "/var/cfengine/bin/cf-hub --query-host 192.168.56.10 --query rebase"
cf-remote sudo -H hub "/var/cfengine/bin/cf-hub --query-host 192.168.56.10 --query delta"
Expand Down
3 changes: 2 additions & 1 deletion simple/encrypt-demo.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
set -ex
cf-secret encrypt -H 192.168.56.10,192.168.56.7,192.168.56.20 -o /home/vagrant/secret.dat -
host_ips=$(cf-key -s | grep Incoming | awk '{print $2}' | paste -s -d,)
cf-secret encrypt -H $host_ips -o /home/vagrant/secret.dat -
chown vagrant /home/vagrant/secret.dat

0 comments on commit d35b9ac

Please sign in to comment.