Browse Source

Merge branch 'feature/autologin' into 'master'

Enable/disable console autologin

See merge request !4
tags/2016.12
Aleš Komárek 9 years ago
parent
commit
d9cbe0d4d6
3 changed files with 41 additions and 0 deletions
  1. +12
    -0
      README.rst
  2. +26
    -0
      linux/system/console.sls
  3. +3
    -0
      linux/system/init.sls

+ 12
- 0
README.rst View File

@@ -106,6 +106,18 @@ Linux with cron jobs
hour: 2
minute: 0

Enable autologin on tty1 (may work only for Ubuntu 14.04):

.. code-block:: yaml

linux:
system:
console:
tty1:
autologin: root

To disable set autologin to `false`.

Repositories
~~~~~~~~~~~~


+ 26
- 0
linux/system/console.sls View File

@@ -0,0 +1,26 @@
{%- from "linux/map.jinja" import system with context %}
{%- if system.enabled %}

{%- if system.console is defined %}

{%- 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"
{%- endif %}

{%- endfor %}

{%- endif %}

{%- endif %}

+ 3
- 0
linux/system/init.sls View File

@@ -33,3 +33,6 @@ include:
{%- if system.apparmor is defined %}
- linux.system.apparmor
{%- endif %}
{%- if system.console is defined %}
- linux.system.console
{%- endif %}

Loading…
Cancel
Save