aboutsummaryrefslogtreecommitdiffstats
path: root/roles/vmm/tasks/generate_vmconf.yml
blob: e8f8245c6fe3eb16f53b7347bc93eacd87132be4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

# vmm ~~ tasks/generate_vmconf.yml
# Generate vm.conf on hypervisor.

---

- 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"
  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 vmd
  service:
    name: vmd
    state: restarted
    enabled: true
remember that computers suck.