Saltstack Official Linux Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
706B

  1. {%- from "linux/map.jinja" import system with context %}
  2. {%- if system.enabled %}
  3. {%- if system.console is defined %}
  4. {%- for tty_name, console in system.console.iteritems() %}
  5. {%- if console.autologin %}
  6. autologin_{{ tty_name }}_enable:
  7. cmd.run:
  8. - name: "sed -i 's|/sbin/getty|/sbin/getty --autologin {{ console.autologin }}|g' /etc/init/{{ tty_name }}.conf"
  9. - unless: |
  10. "grep '\-\-autologin' /etc/init/{{ tty_name }}.conf"
  11. {%- else %}
  12. autologin_{{ tty_name }}_disable:
  13. cmd.run:
  14. - name: "sed -i 's| \-\-autologin [a-zA-Z0-9]*||g' /etc/init/{{ tty_name }}.conf"
  15. - onlyif: |
  16. "grep '\-\-autologin' /etc/init/{{ tty_name }}.conf"
  17. {%- endif %}
  18. {%- endfor %}
  19. {%- endif %}
  20. {%- endif %}