diff options
-rw-r--r-- | roles/vmm/tasks/init_vm.yml | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/roles/vmm/tasks/init_vm.yml b/roles/vmm/tasks/init_vm.yml index 4ded177..6b5cf4d 100644 --- a/roles/vmm/tasks/init_vm.yml +++ b/roles/vmm/tasks/init_vm.yml @@ -6,8 +6,24 @@ - include_role: name: serial +- name: Stop vm if running + shell: vmctl stop "{{ guest }}" ; vmctl stop vm-tmp + ignore_errors: true + - set_fact: - + iso: "{{ vms | selectattr('name', 'equalto', guest) | map(attribute='iso') | first }}" + +- debug: + var: iso + +- include: set_facts.yml + +- name: Start temporary vm + shell: vmctl start -r {{ iso_latest }} -d {{ disk_file }} -n {{ vmm.switch.name }} -m 1G vm-tmp + +- name: Pause 30 seconds for vm boot + pause: + seconds: 30 - name: Init vm via script script: init_vm_serial.py \ @@ -19,8 +35,4 @@ "{{ lookup('file', inventory_dir + '/files/pubkeys/rgoncalves.pub') }}" args: executable: "/usr/local/bin/python3" - register: rg -- name: Installation result - debug: - var: rg.stdout_lines |