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 a13b625 commit 5607428
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
34 changes: 29 additions & 5 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
#!/usr/bin/env bash
set -ex

function wait
{
set +x
echo -n "$@"
read -r _r
set -x
}
vm up
vm ssh-config

# setup cf-remote names
wait "setup cf-remote names..."
cf-remote destroy --all # start over each time
cf-remote save --role hub --name server --hosts vagrant@ubuntu-20
cf-remote save --role hub --name hub --hosts vagrant@ubuntu-22
cf-remote save --role clients --name clients --hosts vagrant@debian-10,vagrant@centos-7
cf-remote save --role clients --name all --hosts vagrant@ubuntu-20,vagrant@ubuntu-22,vagrant@debian-10,vagrant@centos-7

# uninstall
wait "uninstall..."
cf-remote uninstall -H all

# install community, bootstrap
wait "install community, bootstrap..."
cf-remote sudo -H server "apt install -y python3-pip; pip3 install cfbs"
cf-remote install --edition community --clients server --bootstrap 192.168.56.20
cf-remote sudo -H server "curl --silent https://raw.githubusercontent.com/cfengine/core/master/contrib/masterfiles-stage/install-masterfiles-stage.sh --remote-name"
Expand All @@ -28,13 +35,30 @@ cf-remote sudo -H server "cp /home/vagrant/cfe /usr/bin/cfe; chmod +x /usr/bin/c
cf-remote sudo -H server cfe
cf-remote install --edition community --clients clients --bootstrap 192.168.56.20

# play around for a bit, setup the secret with cf-secret
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 cfe
cf-remote sudo -H server,clients "/var/cfengine/bin/cf-agent -K"

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

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 "upgrade debian-10 to enterprise..."
cf-remote uninstall -H debian-10
cf-remote install --clients debian-10 --bootstrap 192.168.56.22
cf-remote sudo -H debian-10 cfe

wait "upgrade centos-7 to enterprise and rebootstrap..."
cf-remote uninstall -H centos-7
cf-remote install --clients centos-7 --bootstrap 192.168.56.7
cf-remote sudo -H centos-7 cfe
1 change: 1 addition & 0 deletions simple/inventory.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ for client_ip in $(cf-key -s | grep Incoming | awk '{print $2}'); do
for dir in $(cf-net -H $client_ip opendir /var/cfengine/data | grep -v '^\.'); do
for file in $(cf-net -H $client_ip opendir /var/cfengine/data/$dir | grep -v '^\.'); do
mkdir -p /var/cfengine/data/$dir
cd /var/cfengine/data/$dir
cf-net -H $client_ip get /var/cfengine/data/$dir/$file
done
done
Expand Down

0 comments on commit 5607428

Please sign in to comment.