-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathos-update-distro
57 lines (57 loc) · 1.96 KB
/
os-update-distro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
machines=($(juju machines | awk '{print $1}'| tail -n +2))
# preparing the machines for upgrade
for machine in ${machines[@]}
do
echo ">> Working on $machine"
juju upgrade-series $machine prepare focal
done
echo ">> Press any key (aka as enter) to continue?"
read
# start with lxd containers
for machine in ${machines[@]}
do
if [[ $machine = *lxd* ]]; then
echo ">> Working on $machine"
juju scp ./release-upgrades $machine:.
juju ssh $machine sudo mv ./release-upgrades /etc/update-manager/release-upgrades
juju ssh $machine sudo apt update
juju ssh $machine sudo apt -y full-upgrade
juju ssh $machine sudo apt -y autoremove
####### DO NOT LEAVE THE ONE YOU UPGRADED UNCOMMENTED
# juju ssh $machine sudo add-apt-repository -y cloud-archive:wallaby
# juju ssh $machine sudo add-apt-repository -y cloud-archive:victoria
#######
juju ssh $machine sudo apt update
# juju ssh $machine sudo do-release-upgrade
fi
done
# continuing with the physical machines
for machine in ${machines[@]}
do
if [[ $machine != *lxd* ]]; then
echo ">> Working on $machine"
juju scp ./release-upgrades $machine:.
juju ssh $machine sudo mv ./release-upgrades /etc/update-manager/release-upgrades
juju ssh $machine sudo apt update
juju ssh $machine sudo apt -y full-upgrade
juju ssh $machine sudo apt -y autoremove
####### DO NOT LEAVE THE ONE YOU UPGRADED UNCOMMENTED
# juju ssh $machine sudo add-apt-repository -y cloud-archive:wallaby
# juju ssh $machine sudo add-apt-repository -y cloud-archive:victoria
#######
juju ssh $machine sudo apt update
# juju ssh $machine sudo do-release-upgrade
fi
done
# finishing the charm upgrade
watch -n 5 -c juju machines --color
echo ">> If all went fine press enter. If not... good luck :)"
read
for machine in ${machines[@]}
do
echo ">> Working on $machine"
juju upgrade-series $machine complete
done
echo ">> Press any key to continue?"
read