MNAIO: Inject the host ssh public key into the image
To allow a downloaded set of file-backed images to be used on another host, the new host's public ssh key needs to be injected into the VM disks so that ansible is able to connect to it and complete the rest of the preparation. Change-Id: I6b9b5efb88283417c15f74f40cfb91943bb8774d
This commit is contained in:
parent
934a3c2651
commit
7f39e408e3
@ -118,6 +118,22 @@
|
||||
- hostvars[item]['server_vm'] | default(false) | bool
|
||||
with_items: "{{ groups['pxe_servers'] }}"
|
||||
|
||||
# Note (odyssey4me):
|
||||
# This will only work on a host which has
|
||||
# libguestfs >= 1.35.2 and >= 1.34.1
|
||||
# Ubuntu bionic works, but xenial does not (even with UCA).
|
||||
# ref: https://bugs.launchpad.net/ubuntu/+source/libguestfs/+bug/1615337.
|
||||
- name: Inject the host ssh key into the VM disk image
|
||||
command: >-
|
||||
virt-sysprep
|
||||
--enable customize
|
||||
--ssh-inject root:file:/root/.ssh/id_rsa.pub
|
||||
--add {{ _virt_pools.pools.default.path | default('/data/images') }}/{{ hostvars[item]['server_hostname'] }}.img
|
||||
when:
|
||||
- vm_use_snapshot | bool
|
||||
- hostvars[item]['server_vm'] | default(false) | bool
|
||||
with_items: "{{ groups['pxe_servers'] }}"
|
||||
|
||||
- name: Wait for guest capabilities to appear
|
||||
command: "virsh capabilities"
|
||||
register: virsh_caps
|
||||
|
@ -34,6 +34,7 @@ mnaio_host_distro_packages:
|
||||
- bridge-utils
|
||||
- ifenslave
|
||||
- iptables-persistent
|
||||
- libguestfs-tools
|
||||
- libvirt-bin
|
||||
- lvm2
|
||||
- ntp
|
||||
|
Loading…
x
Reference in New Issue
Block a user