Skip to content

Commit

Permalink
Add more options
Browse files Browse the repository at this point in the history
  • Loading branch information
tom91136 committed Sep 16, 2024
1 parent 3ce7b2b commit d6ab88c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ ungrouped:
pve_username: root@pam
pve_password: vagrant
pve_node: pve
pve_ip: <YOUR_UNIQUE_IP_ADDR_FOR_PVE_LAN_ONLY>
router_host: router
router_password: <YOUR_PASSWORD>
router_disk_size: 6G
Expand Down
2 changes: 1 addition & 1 deletion playbook-vm-idm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
vm_net:
net0: "virtio,bridge=vmbr1"
vm_scsi:
scsi0: "{{storage_pool}}:0,import-from=/var/lib/vz/template/bos.x86_64.{{idm_disk_size}}.qcow2,format=qcow2,cache=none,ssd=1,discard=on"
scsi0: "{{storage_pool}}:0,import-from=/var/lib/vz/template/bos.x86_64.{{idm_disk_size}}.qcow2,format={{disk_format}},cache=none,ssd=1,discard=on"

- include_tasks: tasks/pve_vm_state.yml
vars: { vm_name: "idm.{{domain}}", vm_state: started }
Expand Down
2 changes: 1 addition & 1 deletion playbook-vm-login.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
vm_net:
net0: "virtio,bridge=vmbr1"
vm_scsi:
scsi0: "{{storage_pool}}:0,import-from=/var/lib/vz/template/bos.{{item}}.{{login_disk_size}}.qcow2,format=qcow2,cache=none,ssd=1,discard=on"
scsi0: "{{storage_pool}}:0,import-from=/var/lib/vz/template/bos.{{item}}.{{login_disk_size}}.qcow2,format={{disk_format}},cache=none,ssd=1,discard=on"
loop: [x86_64, aarch64]

- name: Patch up aarch64 login nodes
Expand Down
10 changes: 5 additions & 5 deletions playbook-vm-mgmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
changed_when: false

- set_fact:
rds1_disk_spec: "{{storage_pool}}:0,import-from={{mgmt_rds_disk}},format=qcow2,serial=rds1"
rds1_disk_spec: "{{storage_pool}}:0,import-from={{mgmt_rds_disk}},format={{disk_format}},serial=rds1"
when: "'QEMU QCOW Image' in mgmt_rds_file_type.stdout"

- set_fact:
Expand All @@ -53,7 +53,7 @@
vm_net:
net0: "virtio,bridge=vmbr1"
vm_scsi:
scsi0: "{{storage_pool}}:0,import-from=/var/lib/vz/template/bos.x86_64.{{mgmt_disk_size}}.qcow2,format=qcow2,cache=none,ssd=1,discard=on"
scsi0: "{{storage_pool}}:0,import-from=/var/lib/vz/template/bos.x86_64.{{mgmt_disk_size}}.qcow2,format={{disk_format}},cache=none,ssd=1,discard=on"
scsi1: "{{rds1_disk_spec}}"

- include_tasks: tasks/pve_vm_state.yml
Expand Down Expand Up @@ -86,7 +86,7 @@
ansible.builtin.copy:
dest: "/etc/crypttab"
content: |
rds1 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_rds1-part1 /boot/luks.key luks,nofail
rds1 {{mgmt_rds_part}} /boot/luks.key luks
- name: Setup rds1 mount point
ansible.builtin.file:
Expand All @@ -97,8 +97,8 @@
ansible.posix.mount:
path: /mnt/rds1
src: /dev/mapper/rds1
opts: nofail,uquota
fstype: xfs
opts: "{{mgmt_rds_opts}}"
fstype: "{{mgmt_rds_fstype}}"
state: present

- name: Reboot
Expand Down
8 changes: 4 additions & 4 deletions playbook-vm-router.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
cores: "{{router_ncores}}"
memory: "{{1024 * router_mem_gb}}"
net:
net0: "virtio,bridge=vmbr0"
net1: "virtio,bridge=vmbr1"
net2: "virtio,bridge=vmbr2"
net0: "virtio,bridge={{router_inet_wan}}"
net1: "virtio,bridge={{router_inet_lan}}"
net2: "virtio,bridge={{router_inet_mgmt}}"
scsihw: "virtio-scsi-single"
scsi:
scsi0: "{{storage_pool}}:0,import-from=/var/lib/vz/template/opnsense.amd64.{{router_disk_size}}.qcow2,format=qcow2,cache=none,ssd=1,discard=on"
scsi0: "{{storage_pool}}:0,import-from=/var/lib/vz/template/opnsense.amd64.{{router_disk_size}}.qcow2,format={{disk_format}},cache=none,ssd=1,discard=on"

- include_tasks: tasks/pve_vm_state.yml
vars: { vm_name: "router.{{domain}}", vm_state: started }
Expand Down
12 changes: 9 additions & 3 deletions staging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def self.common_vars(storage_pool)
arch_to_dns_map: {
x86_64: 'amd64',
aarch64: 'arm64'
}
},
disk_format: 'qcow2'
}
end

Expand All @@ -63,15 +64,17 @@ def self.write_inventory(pve_ip:, storage_pool:, extra_hosts:, host_common_hash:
pve_vars = {
pve_username: 'root@pam',
pve_password: 'vagrant',
pve_node: 'pve',
pve_ip: pve_ip
pve_node: 'pve'
}
router_node_vars = {
router_host: 'router',
router_password: test_password,
router_disk_size: '6G',
router_mem_gb: 2,
router_ncores: 4,
router_inet_wan: 'vmbr0',
router_inet_lan: 'vmbr1',
router_inet_mgmt: 'vmbr2',
router_ip: '10.10.10.10',
router_mgmt_ip: '10.10.20.1',
router_mgmt_dhcp_start: '10.10.20.2',
Expand All @@ -98,6 +101,9 @@ def self.write_inventory(pve_ip:, storage_pool:, extra_hosts:, host_common_hash:
mgmt_ncores: 4,
mgmt_sshkeys: ssh_keys,
mgmt_rds_disk: '/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_rds1',
mgmt_rds_part: '/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_rds1-part1',
mgmt_rds_fstype: 'xfs',
mgmt_rds_opts: 'uquota',
mgmt_ip: '10.10.10.102',
# following are only used for warewulf config generation
mgmt_netmask: '255.255.0.0',
Expand Down

0 comments on commit d6ab88c

Please sign in to comment.