2023-09-26 19:50:11 +00:00
|
|
|
- name: Initialise VM
|
|
|
|
hosts: cloud
|
|
|
|
gather_facts: false
|
|
|
|
tasks:
|
|
|
|
- name: Wait for connection
|
|
|
|
ansible.builtin.wait_for_connection:
|
|
|
|
timeout: 300
|
|
|
|
- name: Install system packages
|
|
|
|
ansible.builtin.apt:
|
|
|
|
update_cache: true
|
|
|
|
pkg:
|
|
|
|
- qemu-guest-agent
|
|
|
|
- parted
|
|
|
|
become: true
|
|
|
|
- name: Enable qemu-guest-agent
|
|
|
|
ansible.builtin.systemd:
|
|
|
|
name: qemu-guest-agent
|
|
|
|
state: started
|
|
|
|
enabled: true
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Create data partition
|
|
|
|
community.general.parted:
|
|
|
|
device: /dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:1
|
|
|
|
label: gpt
|
|
|
|
name: data
|
|
|
|
number: 1
|
|
|
|
state: present
|
|
|
|
become: true
|
|
|
|
- name: Create data filesystem
|
|
|
|
community.general.filesystem:
|
|
|
|
dev: /dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:1-part1
|
|
|
|
fstype: ext4
|
|
|
|
become: true
|
|
|
|
- name: Mount data partition
|
|
|
|
ansible.posix.mount:
|
|
|
|
src: /dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:1-part1
|
2023-09-26 23:24:07 +00:00
|
|
|
path: /var/lib/docker
|
2023-09-26 19:50:11 +00:00
|
|
|
fstype: ext4
|
|
|
|
opts: rw,errors=remount-ro,x-systemd.growfs
|
|
|
|
state: mounted
|
|
|
|
become: true
|
2023-09-27 21:18:49 +00:00
|
|
|
|
|
|
|
- name: Create media partition
|
|
|
|
community.general.parted:
|
|
|
|
device: /dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:2
|
|
|
|
label: gpt
|
|
|
|
name: media
|
|
|
|
number: 1
|
|
|
|
state: present
|
|
|
|
become: true
|
|
|
|
- name: Create media filesystem
|
|
|
|
community.general.filesystem:
|
|
|
|
dev: /dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:2-part1
|
|
|
|
fstype: ext4
|
|
|
|
become: true
|
|
|
|
- name: Mount media partition
|
|
|
|
ansible.posix.mount:
|
|
|
|
src: /dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:2-part1
|
|
|
|
path: /mnt/media
|
|
|
|
fstype: ext4
|
|
|
|
opts: rw,errors=remount-ro,x-systemd.growfs
|
|
|
|
state: mounted
|
|
|
|
become: true
|