diff options
Diffstat (limited to 'roles/vmm/tasks/main.yml')
-rw-r--r-- | roles/vmm/tasks/main.yml | 64 |
1 files changed, 49 insertions, 15 deletions
diff --git a/roles/vmm/tasks/main.yml b/roles/vmm/tasks/main.yml index 81ddafc..3972e63 100644 --- a/roles/vmm/tasks/main.yml +++ b/roles/vmm/tasks/main.yml @@ -1,26 +1,60 @@ -# vmm_deploy ~~ tasks/main.yml +# vmm ~~ roles/vmm/tasks/main.yml +# vmm generation for hypervisor --- -- name: Check that iso directory exists +- name: ensure existence of vmm directories file: - path: "{{ vmm.iso_dir }}" + path: "{{ item }}" + owner: "{{ user_root }}" + group: "{{ group_root }}" + mode: 0770 state: directory - recurse: true + loop: + - "{{ vmm.dir }}" + - "{{ vmm.iso_dir }}" + - "{{ vmm.disk_dir }}" -- name: Check that disk directory exists - file: - path: "{{ vmm.disk_dir }}" - state: directory - recurse: true - -- name: Download all iso files - include: download_iso.yml iso={{ item }} +- name: download all iso files + include: isos.yml iso={{ item }} with_items: "{{ vmm.iso }}" -- name: Generate disks for all vms - include: generate_disk.yml guest={{ item }} +- name: generate disks for all vms + include: disks.yml guest={{ item }} with_items: "{{ vms }}" -- include: generate_vmconf.yml +- name: start ip forwarding + shell: sysctl net.inet.ip{{ item }}.forwarding=1 + loop: + - "" + - "6" + +- name: enable ip forwarding + lineinfile: + path: /etc/sysctl.conf + regexp: "^net.inet.ip{{ item }}.forwarding=" + line: "net.inet.ip{{ item }}.forwarding=1" + owner: "{{ user_root }}" + group: "{{ group_root }}" + create: yes + loop: + - "" + - "6" + +- name: create network switch + shell: echo "add {{ hypervisor.interface }}" > /etc/hostname.{{ vmm.switch.iface }} + +- name: start network switch + shell: "sh /etc/netstart {{ vmm.switch.iface }}" + +- name: generate vmm configuration + template: + src: templates/vm.conf.j2 + dest: "{{ vmm.config_file }}" + +- name: restart and enable vmd + service: + name: vmd + state: restarted + enabled: true |