Files
ssd_health/tasks/autologin.yaml
2025-11-30 22:17:14 -08:00

78 lines
2.2 KiB
YAML

---
- name: autologin - edit logind to reduce vterms to one
lineinfile:
dest: /etc/systemd/logind.conf
regexp: '^#NAutoVTs=6'
line: 'NAutoVTs=1'
backrefs: yes
- name: autologin - create getty tty1 service folder
file:
path: /etc/systemd/system/getty@tty1.service.d/
state: directory
mode: '0700'
- name: autologin - "create {{ autologin_user }} .bash_aliases"
copy:
#dest: "/home/{{ autologin_user }}/.bash_aliases"
dest: "/home/{{ autologin_user }}/.bash_aliases"
owner: "{{ autologin_user }}"
group: "{{ autologin_user }}"
mode: '0600'
content: |
clear
cat {{ service_folder }}/hello-there.txt
sleep 4
{{ service_folder }}/drive_check.sh
- name: autologin - add autologin override to getty tty1 service
copy:
dest: /etc/systemd/system/getty@tty1.service.d/override.conf
content: |
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin {{ autologin_user }} --noclear %I 38400 linux
- name: autologin - quick refresh skippable tasks
when: not quick_refresh | bool
block:
# create hello_there ASCII art
- name: autologin - generate hello_there.txt for the lulz
include_tasks: hello_there.yaml
- name: User setup - update permissions on smartctl 1
shell: "chmod 755 /usr/sbin/smartctl"
- name: autologin - User setup - update permissions on smartctl 2
shell: "chmod u+s /usr/sbin/smartctl"
- name: autologin - User setup - update permissions on fdisk
shell: "chmod u+s /usr/sbin/fdisk"
- name: autologin - User setup - create symlink for smartctl
ignore_errors: yes
shell: "ln /usr/sbin/smartctl /usr/bin/smartctl"
- name: autologin - User setup - create symlink for fdisk
ignore_errors: yes
shell: "ln /usr/sbin/fdisk /usr/bin/fdisk"
- name: autologin - "User setup - allow {{ autologin_user }} to smartctl"
copy:
dest: /etc/sudoers.d/smartctl
content: |
{{ autologin_user }} ALL=(ALL) NOPASSWD: /usr/sbin/smartctl
{{ autologin_user }} ALL=(ALL) NOPASSWD: /usr/sbin/fdisk
- name: autologin - Restart getty@tty1 service
systemd:
name: getty@tty1.service
state: restarted
enabled: true
masked: false
daemon_reload: true
...