We use the vsphere-iso builder plugin to create a RHEL based VMware template image, which works great. Our kickstart script includes the public part of the ssh-key into /root/.ssh/authorized_keys and packer is able to login afterwards via SSH.
However, the public key is not removed from authorized_keys afterwards, even when instructed to do so:
communicator = "ssh"
ssh_username = "root"
ssh_private_key_file = "/home/packer/.ssh/id_ed25519_packer"
ssh_timeout = "20m"
ssh_keypair_name = "packer_buildhost"
ssh_clear_authorized_keys = true
The contents of /root/.ssh/authorized_keys after image creation still remain as follows:
ssh-ed25519 AAAAC3...redacted... packer_buildhost
Which should match the ssh_keypair_name setting. We even tried adding temporary_key_pair_name to the configuration with the same value, but no better result.
Please advice me if I’m doing something wrong here, or if this might be a bug?
Thanks in advance!