diff options
author | binary <me@rgoncalves.se> | 2020-11-09 13:25:05 +0100 |
---|---|---|
committer | binary <me@rgoncalves.se> | 2020-11-09 13:25:05 +0100 |
commit | 80b5d3d5b8846bd0396dbe38fe83f85c34f84ede (patch) | |
tree | d1cec4c5989f8635ff14c11e1737f6f735ec96dc /roles/vmm | |
parent | b76ff7af157679c2739666fcae04076760359c4c (diff) | |
download | infrastructure-80b5d3d5b8846bd0396dbe38fe83f85c34f84ede.tar.gz |
Start and stop vm
Diffstat (limited to 'roles/vmm')
-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 |