kovalhome/infra/cloud/0001_initialise_playbook.yaml

48 lines
1.2 KiB
YAML
Raw Normal View History

2023-09-25 20:48:29 +00:00
- name: Initialise VM
2023-09-25 21:30:52 +00:00
hosts: cloud
2023-09-25 20:48:29 +00:00
gather_facts: false
tasks:
- name: Wait for connection
ansible.builtin.wait_for_connection:
timeout: 300
- name: Install system packages
ansible.builtin.apt:
2023-09-25 20:57:43 +00:00
update_cache: true
2023-09-25 22:48:06 +00:00
pkg:
- qemu-guest-agent
- parted
2023-09-25 20:48:29 +00:00
become: true
- name: Enable qemu-guest-agent
ansible.builtin.systemd:
name: qemu-guest-agent
state: started
enabled: true
become: true
2023-09-25 22:23:58 +00:00
- 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
2023-09-25 23:15:19 +00:00
- 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
2023-09-25 23:23:05 +00:00
become: true
2023-09-25 22:23:58 +00:00
- name: Mount data partition
ansible.posix.mount:
src: /dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:1-part1
path: /mnt/data
fstype: ext4
2023-09-25 22:54:41 +00:00
state: mounted
2023-09-25 22:23:58 +00:00
become: true
- name: Set data partition permissions
ansible.builtin.file:
path: /mnt/data
owner: debian
group: debian
become: true