From 352c98322771af117a85904d580e1c062062d634 Mon Sep 17 00:00:00 2001 From: binary Date: Sat, 7 Nov 2020 20:38:07 +0100 Subject: Refactor vmm role with automation --- roles/vmm/tasks/generate_vmconf.yml | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'roles/vmm/tasks/generate_vmconf.yml') diff --git a/roles/vmm/tasks/generate_vmconf.yml b/roles/vmm/tasks/generate_vmconf.yml index 9f120fd..c4e80d8 100644 --- a/roles/vmm/tasks/generate_vmconf.yml +++ b/roles/vmm/tasks/generate_vmconf.yml @@ -1,29 +1,24 @@ # vmm ~~ tasks/generate_vmconf.yml +# Generate vm.conf on hypervisor. --- +- name: Create network switch + template: + src: templates/hostname.j2 + dest: "/etc/hostname.{{ vmm.switch.interface }}" + +- name: Start network switch + shell: "sh /etc/netstart {{ vmm.switch.interface }}" + - name: Generate vmm configuration template: src: templates/vm.conf.j2 - dest: "{{ vmm.config.file }}" - -- name: Create empty disk - file: - path: "{{ vmm.disk.dir }}/{{ hostvars[item].ansible_host }}.{{ vmm.disk.format }}" - state: touch - loop: "{{ vm.hosts }}" + dest: "{{ vmm.config_file }}" -- name: Restart and enable vmd +- name: Restart vmd service: name: vmd state: restarted enabled: true - when: vm.enabled - -- name: Stop and disable vmd - service: - name: vmd - state: stopped - enabled: false - when: not vm.enabled -- cgit v1.2.3