File tree Expand file tree Collapse file tree 4 files changed +24
-8
lines changed Expand file tree Collapse file tree 4 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,11 @@ Role Variables
60
60
Each network interface is defined with the following dict:
61
61
- ` network ` : Name of the network to which an interface should be attached.
62
62
63
+ - ` console_log_enabled ` : if ` true ` , log console output to a file at the
64
+ path specified by ` console_log_path ` , ** instead of** to a PTY. If
65
+ ` false ` , direct terminal output to a PTY at serial port 0. Default is
66
+ ` false ` .
67
+
63
68
- ` console_log_path ` : Path to console log file. Default is
64
69
` {{ libvirt_vm_default_console_log_dir }}/{{ name }}-console.log ` .
65
70
Original file line number Diff line number Diff line change 13
13
14
14
- include_tasks : vm.yml
15
15
vars :
16
+ console_log_enabled : " {{ vm.console_log_enabled | default(false) }}"
16
17
console_log_path : " {{ vm.console_log_path | default(libvirt_vm_default_console_log_dir + '/' + vm.name + '-console.log', true) }}"
17
18
machine_default : " {{ none if libvirt_vm_engine == 'kvm' else 'pc-1.0' }}"
18
19
machine : " {{ vm.machine | default(machine_default, true) }}"
Original file line number Diff line number Diff line change 7
7
group : qemu
8
8
recurse : true
9
9
mode : 0770
10
+ when : console_log_enabled | bool
10
11
become : true
11
12
12
13
- name : Ensure the VM is defined
Original file line number Diff line number Diff line change 31
31
<model type =' virtio' />
32
32
</interface >
33
33
{% endfor %}
34
- <serial type =' file' >
35
- <source path =' {{ console_log_path }}' />
36
- </serial >
37
- <serial type =' pty' />
38
- <console type =' file' >
39
- <source path =' {{ console_log_path }}' />
40
- <target type =' serial' />
41
- </console >
34
+ {% if console_log_enabled | bool %}
35
+ <serial type =' file' >
36
+ <source path =' {{ console_log_path }}' />
37
+ </serial >
38
+ <serial type =' pty' />
39
+ <console type =' file' >
40
+ <source path =' {{ console_log_path }}' />
41
+ <target type =' serial' />
42
+ </console >
43
+ {% else %}
44
+ <serial type =' pty' >
45
+ <target port =' 0' />
46
+ </serial >
47
+ <console type =' pty' >
48
+ <target type =' serial' port =' 0' />
49
+ </console >
50
+ {% endif %}
42
51
</devices >
43
52
</domain >
You can’t perform that action at this time.
0 commit comments