Support for serial text consoles this PR is for following: issue/528 to have it enabled, you need smth like: ``` parameters: linux: system: console: ttyS0: autologin: root rate: 115200 term: xterm ``` See merge request !10tags/2016.12
console: | console: | ||||
tty1: | tty1: | ||||
autologin: root | autologin: root | ||||
# Enable serial console | |||||
ttyS0: | |||||
autologin: root | |||||
rate: 115200 | |||||
term: xterm | |||||
To disable set autologin to `false`. | To disable set autologin to `false`. | ||||
# {{ name }} - getty | |||||
# | |||||
# This service maintains a getty on tty1 from the point the system is | |||||
# started until it is shut down again. | |||||
start on stopped rc RUNLEVEL=[2345] and ( | |||||
not-container or | |||||
container CONTAINER=lxc or | |||||
container CONTAINER=lxc-libvirt) | |||||
stop on runlevel [!2345] | |||||
respawn | |||||
exec /sbin/getty{% if tty.get('autologin', False) %} --autologin {{ tty.autologin }}{% endif %} -8 {{ tty.get('rate', 38400) }} {{ name }}{% if tty.term is defined %} {{ tty.term }}{% endif %} |
{%- for tty_name, console in system.console.iteritems() %} | {%- for tty_name, console in system.console.iteritems() %} | ||||
{%- if console.autologin %} | |||||
autologin_{{ tty_name }}_enable: | |||||
cmd.run: | |||||
- name: "sed -i 's|/sbin/getty|/sbin/getty --autologin {{ console.autologin }}|g' /etc/init/{{ tty_name }}.conf" | |||||
- unless: "grep 'autologin' /etc/init/{{ tty_name }}.conf" | |||||
{%- else %} | |||||
autologin_{{ tty_name }}_disable: | |||||
cmd.run: | |||||
- name: "sed -i 's| \-\-autologin [a-zA-Z0-9]*||g' /etc/init/{{ tty_name }}.conf" | |||||
- onlyif: "grep 'autologin' /etc/init/{{ tty_name }}.conf" | |||||
{%- if grains['init'] == 'upstart' %} | |||||
{{ tty_name }}_service_file: | |||||
file.managed: | |||||
- name: /etc/init/{{ tty_name }}.conf | |||||
- source: salt://linux/files/tty.upstart | |||||
- template: jinja | |||||
- defaults: | |||||
name: {{ tty_name }} | |||||
tty: {{ console }} | |||||
{%- endif %} | {%- endif %} | ||||
{{ tty_name }}_service: | |||||
service.running: | |||||
- enable: true | |||||
- name: {{ tty_name }} | |||||
- watch: | |||||
- file: {{ tty_name }}_service_file | |||||
{%- endfor %} | {%- endfor %} | ||||
{%- endif %} | {%- endif %} |
enabled: false | enabled: false | ||||
console: | console: | ||||
tty0: | tty0: | ||||
autologin: true | |||||
autologin: root | |||||
ttyS0: | |||||
autologin: root | |||||
rate: 115200 | |||||
term: xterm | |||||
prompt: | prompt: | ||||
default: "test01.local$" | default: "test01.local$" | ||||
motd: | motd: |