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
6060 Each network interface is defined with the following dict:
6161 - ` network ` : Name of the network to which an interface should be attached.
6262
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+
6368 - ` console_log_path ` : Path to console log file. Default is
6469 ` {{ libvirt_vm_default_console_log_dir }}/{{ name }}-console.log ` .
6570
Original file line number Diff line number Diff line change 1313
1414- include_tasks : vm.yml
1515 vars :
16+ console_log_enabled : " {{ vm.console_log_enabled | default(false) }}"
1617 console_log_path : " {{ vm.console_log_path | default(libvirt_vm_default_console_log_dir + '/' + vm.name + '-console.log', true) }}"
1718 machine_default : " {{ none if libvirt_vm_engine == 'kvm' else 'pc-1.0' }}"
1819 machine : " {{ vm.machine | default(machine_default, true) }}"
Original file line number Diff line number Diff line change 77 group : qemu
88 recurse : true
99 mode : 0770
10+ when : console_log_enabled | bool
1011 become : true
1112
1213- name : Ensure the VM is defined
Original file line number Diff line number Diff line change 3131 <model type =' virtio' />
3232 </interface >
3333{% 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 %}
4251 </devices >
4352</domain >
You can’t perform that action at this time.
0 commit comments