diff options
author | binary <me@rgoncalves.se> | 2020-11-07 20:38:07 +0100 |
---|---|---|
committer | binary <me@rgoncalves.se> | 2020-11-07 20:38:07 +0100 |
commit | 352c98322771af117a85904d580e1c062062d634 (patch) | |
tree | d3bca9d27d6ee5d678264d83fc22030d274f30bf /roles/vmm/tasks/generate_vmconf.yml | |
parent | 282be811d2ac07a76d56ac066df5bf33d748bd64 (diff) | |
download | infrastructure-352c98322771af117a85904d580e1c062062d634.tar.gz |
Refactor vmm role with automation
Diffstat (limited to 'roles/vmm/tasks/generate_vmconf.yml')
-rw-r--r-- | roles/vmm/tasks/generate_vmconf.yml | 27 |
1 files changed, 11 insertions, 16 deletions
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 |