parent
076dc6f191
commit
d5b90baecf
@ -0,0 +1,2 @@ |
||||
instance-id: mirror-dev |
||||
local-hostname: mirror-dev |
@ -0,0 +1,59 @@ |
||||
#cloud-config |
||||
autoinstall: |
||||
version: 1 |
||||
identity: |
||||
hostname: mirror |
||||
username: ubuntu |
||||
# password is just ubuntu |
||||
password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0" |
||||
locale: en_US |
||||
ssh: |
||||
allow-pw: true |
||||
authorized-keys: [] |
||||
install-server: true |
||||
storage: |
||||
config: |
||||
# disks =-=-=-=-=-=-= |
||||
- {id: vda, name: '', path: /dev/vda, type: disk, ptable: gpt, |
||||
preserve: false, grub_device: false} |
||||
- {id: vdb, name: '', path: /dev/vdb, type: disk, ptable: gpt, |
||||
preserve: false, grub_device: false} |
||||
# partitions =-=-=-=-=-= |
||||
# vda1 |
||||
- {id: vda1, type: partition, size: 500M, device: vda, number: 1, |
||||
preserve: false, wipe: superblock, flag: boot, grub_device: true} |
||||
- {id: vda1-format, type: format, volume: vda1, |
||||
fstype: fat32, preserve: false} |
||||
# vda2 |
||||
- {id: vda2, type: partition, size: 9G, device: vda, number: 2, |
||||
preserve: false, wipe: superblock, flag: '', grub_device: false} |
||||
# vdb1 |
||||
- {id: vdb1, type: partition, size: 500M, device: vdb, number: 1, |
||||
preserve: false, wipe: superblock, flag: boot, grub_device: true} |
||||
- {id: vdb1-format, type: format, volume: vdb1, |
||||
fstype: fat32, preserve: false} |
||||
# vdb2 |
||||
- {id: vdb2, type: partition, size: 9G, device: vdb, number: 2, |
||||
preserve: false, wipe: superblock, flag: '', grub_device: false} |
||||
# raid =-=-=-=-=-= |
||||
- id: md0 |
||||
name: md0 |
||||
type: raid |
||||
raidlevel: raid1 |
||||
devices: [vda2, vdb2] |
||||
spare_devices: [] |
||||
preserve: false |
||||
# lvm =-=-=-=-=-= |
||||
- id: vg0 |
||||
name: vg0 |
||||
type: lvm_volgroup |
||||
devices: [md0] |
||||
preserve: false |
||||
# partition |
||||
- {id: vg0-root, name: root, type: lvm_partition, size: 8G, |
||||
preserve: false, volgroup: vg0} |
||||
- {id: vg0-root-format, type: format, volume: vg0-root, |
||||
fstype: ext4, preserve: false} |
||||
# mount points =-=-=-=-=-= |
||||
- {id: boot-mount, type: mount, path: /boot/efi, device: vda1-format} |
||||
- {id: root-mount, type: mount, path: /, device: vg0-root-format} |
@ -0,0 +1,6 @@ |
||||
--- |
||||
- name: Configure all VMs |
||||
include_tasks: vm.yml |
||||
loop: "{{virtual_machines}}" |
||||
loop_control: |
||||
loop_var: vm |
@ -0,0 +1,40 @@ |
||||
--- |
||||
# quite a lot of duplication, probably fix later |
||||
# Gather info |
||||
- name: Check if vm was created already |
||||
stat: |
||||
path: "{{userdata}}/{{vm.name}}" |
||||
register: vmexists |
||||
ignore_errors: true |
||||
- name: Check for ubuntu iso |
||||
stat: |
||||
path: "{{role_path}}/files/ubuntu20_04.iso" |
||||
register: isoexists |
||||
ignore_errors: true |
||||
- name: Check for ubuntu iso seed |
||||
stat: |
||||
path: "{{userdata}}/{{vm.name}}/seed.iso" |
||||
register: seedexists |
||||
ignore_errors: true |
||||
|
||||
# Setting up VM |
||||
- name: Create directory for VM |
||||
file: |
||||
state: directory |
||||
path: "{{userdata}}/{{vm.name}}" |
||||
when: vmexists.stat.exists == false |
||||
|
||||
# didn't use get_url module since it broke with symlinks |
||||
- name: Fetching ubuntu iso |
||||
command: curl -o "{{role_path}}/files/ubuntu20_04.iso" https://releases.ubuntu.com/20.04.3/ubuntu-20.04.3-live-server-amd64.iso |
||||
when: isoexists.stat.exists == false |
||||
|
||||
- name: Create disk images |
||||
shell: |
||||
cmd: "for i in {1..6}; do qemu-img create -f qcow2 {{userdata}}/{{vm.name}}/drive${i} {{vm.disk_size}}; done" |
||||
when: vmexists.stat.exists == false |
||||
|
||||
- name: Creating cloud-init iso |
||||
command: "genisoimage -output {{userdata}}/{{vm.name}}/seed.iso -volid cidata -joliet -rock {{role_path}}/files/user-data {{role_path}}/files/meta-data" |
||||
when: seedexists.stat.exists == false |
||||
|
Loading…
Reference in new issue