I have instances that are deployed in GCP that have /home and /data on additional disks other than the root/boot disk. The partitions are labeled with e2label as home and data so that I can load them from /etc/fstab without knowing the /dev/sdX device paths or the UUIDs.
I can add the needed lines to /etc/fstab to mount these disks on boot, but how can I make /home be empty as the built image is being shut down? I am building with one disk but would like the resulting image to mount the additional disks when it is booted.
Using a normal ansible playbook command to mv /home to /home.old so a blank dir can be made does not seem to work since it prevents the provisioner from getting the stdout.
googlecompute.ubuntu-2004: TASK [prep-for-home-and-data-disks : remove all content from home dir so it can be used as mount point] ***
googlecompute.ubuntu-2004: An exception occurred during task execution. To see the full traceback, use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or directory: ‘/home/sa_101111794417217231111’
I found there is a shutdown_command for other builders but it does not seem to be an option for googlecompute.