Skip to content

Commit ee04cb9

Browse files
committed
Clean up cloud-init artifacts
Use the cloud-init clean command instead of removing the files by hand (/var/lib/cloud) Ref. https://cloudinit.readthedocs.io/en/latest/topics/cli.html#clean ``` $ sudo cloud-init clean -h usage: /usr/bin/cloud-init clean [-h] [-l] [-r] [-s] optional arguments: -h, --help show this help message and exit -l, --logs Remove cloud-init logs. -r, --reboot Reboot system after logs are cleaned so cloud-init re-runs. -s, --seed Remove cloud-init seed directory /var/lib/cloud/seed. ``` Signed-off-by: Luca Carrogu <[email protected]>
1 parent 7b27bb2 commit ee04cb9

File tree

1 file changed

+3
-2
lines changed
  • cookbooks/aws-parallelcluster-install/files/default/base

1 file changed

+3
-2
lines changed

cookbooks/aws-parallelcluster-install/files/default/base/ami_cleanup.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/bin/bash
22

3+
# clean up cloud init artifacts https://cloudinit.readthedocs.io/en/latest/topics/cli.html#clean
4+
cloud-init clean -s
5+
36
rm -rf /var/tmp/* /tmp/*
4-
rm -rf /var/lib/cloud/instances/*
5-
rm -f /var/lib/cloud/instance
67
rm -rf /etc/ssh/ssh_host_*
78
rm -f /etc/udev/rules.d/70-persistent-net.rules
89
grep -l "Created by cloud-init on instance boot automatically" /etc/sysconfig/network-scripts/ifcfg-* | xargs rm -f

0 commit comments

Comments
 (0)