--- - name: create the qcow mount point ansible.builtin.file: state: directory path: "{{ qcow_mountpoint }}" - name: mount the guest qcow template image ansible.builtin.shell: cmd: | guestmount --format=qcow2 \ -a {{ root_vhd_pool_dir }}/{{ vhd_template }} \ -m /dev/vda2 \ {{ qcow_mountpoint }} - name: sysprep the template image ansible.builtin.file: state: absent path: "{{ item }}" with_items: - "{{ qcow_mountpoint }}/home/ladmin/.ssh/" - "{{ qcow_mountpoint }}/root/.ssh/" - "{{ qcow_mountpoint }}/etc/machine-id" - "{{ qcow_mountpoint }}/etc/hostname" - name: unmount the guest qcow image ansible.builtin.shell: cmd: | guestunmount {{ qcow_mountpoint }}