1
0

sysprep problems

This commit is contained in:
michael 2022-10-25 02:55:23 +13:00
parent 8daf2d1ff8
commit c84eb30443
2 changed files with 61 additions and 7 deletions

View File

@ -1,11 +1,29 @@
---
- name: sysprep the template vhd
# when: template_created is changed
- 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: |
virt-sysprep -a {{ root_vhd_pool_dir }}/{{ vhd_template }} \
--format qcow2 \
--delete /etc/systemd/network/* \
--keep-user-accounts ladmin \
--enable user-account,firewall-rules \
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 }}

View File

@ -0,0 +1,36 @@
fdisk on /dev/vda
part 1 start 2048 +512M type UEFI
part 2 remaining type 23 (Linux root x86-64)
mkfs.vfat -F 32 /dev/vda1
mkfs.ext4 /dev/vda2
update archinstall
extra packages:
qemu-guest-agent
nano
openssh
ufw
chroot:
systemctl enable sshd
systemctl enable systemd-networkd
systemctl enable systemd-resolved
manual sysprep steps:
remove /etc/hostname
remove /etc/machine-id
remove /etc/systemd/network/*
remove /home/ladmin/.ssh
remove /root/.ssh
remove /home/ladmin/.bash_history
remove /root/.bash_history
remove /etc/ssh/ssh_host_*
remove /tmp/*
remove /var/tmp/*