From 03700ba0fb399bcf57c4a67818962e649b25adba Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 30 Oct 2022 02:39:44 +1300 Subject: [PATCH] refine disks --- ansible/roles/vm_deploy/tasks/main.yml | 20 ++++++++++++------- .../vm_deploy/templates/vm_template.xml.j2 | 10 ++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ansible/roles/vm_deploy/tasks/main.yml b/ansible/roles/vm_deploy/tasks/main.yml index a516b97..dcdceb5 100644 --- a/ansible/roles/vm_deploy/tasks/main.yml +++ b/ansible/roles/vm_deploy/tasks/main.yml @@ -41,19 +41,25 @@ --password ladmin:password:{{ hostvars[vm_name]['ansible_become_pass'] }} \ --root-password password:{{ hostvars[vm_name]['ansible_root_pass'] }} \ --password-crypto sha512 \ - --ssh-inject "ladmin:string:{{ }}" + --ssh-inject "ladmin:string:{{ hostvars[vm_name]['ssh_public_key_data'] }}" - name: create container storage vhd ansible.builtin.shell: cmd: | qemu-img create -f qcow2 {{ containers_vhd_pool_dir }}/{{ vm_name }}_vdb.qcow2 64G - creates: "{{ root_vhd_pool_dir }}/{{ vm_name }}_vdb.qcow2" + creates: "{{ containers_vhd_pool_dir }}/{{ vm_name }}_vdb.qcow2" - # - name: create data storage vhd - # ansible.builtin.shell: - # cmd: | - # qemu-img create -f qcow2 {{ data_vhd_pool_dir }}/{{ vm_name }}_vdc.qcow2 4T - # creates: "{{ data_vhd_pool_dir }}/{{ vm_name }}_vdc.qcow2" + - name: create nvme data storage vhd + ansible.builtin.shell: + cmd: | + qemu-img create -f qcow2 {{ data_nvme_vhd_pool_dir }}/{{ vm_name }}_vdc.qcow2 64G + creates: "{{ data_nvme_vhd_pool_dir }}/{{ vm_name }}_vdc.qcow2" + + - name: create hdd data storage vhd + ansible.builtin.shell: + cmd: | + qemu-img create -f qcow2 {{ data_hdd_vhd_pool_dir }}/{{ vm_name }}_vdd.qcow2 4T + creates: "{{ data_hdd_vhd_pool_dir }}/{{ vm_name }}_vdd.qcow2" - name: list vms community.libvirt.virt: diff --git a/ansible/roles/vm_deploy/templates/vm_template.xml.j2 b/ansible/roles/vm_deploy/templates/vm_template.xml.j2 index 3a0817d..4e420bd 100644 --- a/ansible/roles/vm_deploy/templates/vm_template.xml.j2 +++ b/ansible/roles/vm_deploy/templates/vm_template.xml.j2 @@ -51,6 +51,16 @@ + + + + + + + + + +