mirror of
https://github.com/bitwarden/self-host.git
synced 2026-06-27 22:05:45 +00:00
fix(azure-marketplace): reset cloud-init state (#518)
This commit is contained in:
@@ -206,6 +206,9 @@ build {
|
||||
"sudo tar -xzf /tmp/walinuxagent.tar.gz -C /opt/walinuxagent-src --strip-components=1",
|
||||
"cd /opt/walinuxagent-src && sudo python3 setup.py install --register-service",
|
||||
"sudo rm -f /tmp/walinuxagent.tar.gz",
|
||||
# Force systemd to re-read units after setup.py modifies walinuxagent.service.
|
||||
# The version systemd has loaded is outdated" on first boot.
|
||||
"sudo systemctl daemon-reload",
|
||||
"sudo systemctl enable walinuxagent",
|
||||
"waagent --version",
|
||||
]
|
||||
|
||||
@@ -78,5 +78,11 @@ done
|
||||
|
||||
find /var/log -mtime -1 -type f -exec truncate -s 0 {} \;
|
||||
rm -rf /var/log/*.gz /var/log/*.[0-9] /var/log/*-????????
|
||||
rm -rf /var/lib/cloud/instances/*
|
||||
# Reset cloud-init state for redeploy. `rm -rf /var/lib/cloud/instances/*` alone
|
||||
# leaves the /var/lib/cloud/instance symlink dangling, which causes cloud-init
|
||||
# to enter `degraded done` on the deployed VM's first boot
|
||||
if command -v cloud-init >/dev/null 2>&1; then
|
||||
cloud-init clean --logs --machine-id
|
||||
fi
|
||||
rm -rf /var/lib/cloud/instance /var/lib/cloud/instances/* /var/lib/cloud/data/* /var/lib/cloud/sem/*
|
||||
rm -f /root/.ssh/authorized_keys /home/ubuntu/.ssh/authorized_keys
|
||||
|
||||
Reference in New Issue
Block a user