1
0
IaC/ansible/roles/vm_template/tasks/main.yml

30 lines
745 B
YAML
Raw Normal View History

2022-10-23 22:50:38 -04:00
---
2022-10-24 09:55:23 -04:00
- 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
2022-10-23 22:50:38 -04:00
ansible.builtin.shell:
cmd: |
2022-10-24 09:55:23 -04:00
guestunmount {{ qcow_mountpoint }}