aboutsummaryrefslogtreecommitdiffstats
path: root/roles/vmm/tasks/main.yml
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2020-12-02 18:36:25 +0100
committerbinary <me@rgoncalves.se>2020-12-02 18:36:25 +0100
commitc4edd14b8aaf65d1db86074b0109b89ae609d4b3 (patch)
tree94e123449ce228ce1bff2dcb701f72956b1ad72c /roles/vmm/tasks/main.yml
parent8478e90356b6738a13eed3878000d0e112074960 (diff)
downloadinfrastructure-c4edd14b8aaf65d1db86074b0109b89ae609d4b3.tar.gz
Refactor based on bhyve setup
Diffstat (limited to 'roles/vmm/tasks/main.yml')
-rw-r--r--roles/vmm/tasks/main.yml64
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
remember that computers suck.