blob: 3c5a462b6290bf06f6790bac864ddbf5661e3e40 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
- name: create vmm directories
file:
path: "{{ item }}"
owner: 0
group: 0
mode: 0770
state: directory
loop:
- "{{ vmm_root_dir }}"
- "{{ vmm_iso_dir }}"
- "{{ vmm_disk_dir }}"
- name: include facts generation
include_tasks: facts.yml
- name: include iso management
include_tasks: iso.yml
tags: task_iso
- name: include disk management
include_tasks: disk.yml
tags: task_disk
- name: start ip forwarding
command: sysctl net.inet.ip{{ item }}.forwarding=1
loop: "{{ vmm_network_forwarded_ips }}"
- name: enable ip forwarding
lineinfile:
path: /etc/sysctl.conf
regexp: "^net.inet.ip{{ item }}.forwarding="
line: "net.inet.ip{{ item }}.forwarding=1"
owner: 0
group: 0
mode: 0640
create: true
loop: "{{ vmm_network_forwarded_ips }}"
- name: create network switch
lineinfile:
path: "/etc/hostname.{{ vmm_network_switch.interface }}"
regexp: &network_line "add {{ ansible_default_ipv4.interface }}"
line: *network_line
owner: 0
group: 0
mode: 0640
create: true
- name: start network switch
command: "sh /etc/netstart {{ vmm_network_switch.interface }}"
- name: generate vmm configuration
template:
src: vm.conf.j2
dest: "{{ vmm_configuration_file }}"
owner: 0
group: 0
mode: 0640
register: result
- name: lint vmm configuration
command: "vmd -nf {{ vmm_configuration_file }}"
when: result.changed
- name: restart and enable vmd
service:
name: vmd
state: restarted
enabled: true
|