Merge "MNAIO: Inject the host ssh public key into the image"

This commit is contained in:
Zuul 2018-09-02 09:07:15 +00:00 committed by Gerrit Code Review
commit f797f5f8b5
2 changed files with 17 additions and 0 deletions

View File

@ -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

View File

@ -34,6 +34,7 @@ mnaio_host_distro_packages:
- bridge-utils
- ifenslave
- iptables-persistent
- libguestfs-tools
- libvirt-bin
- lvm2
- ntp