Files
ssd_health/tasks/user_setup.yaml
2025-11-02 20:31:51 -08:00

43 lines
1.2 KiB
YAML

---
- name: "User setup - create {{ autologin_user }} user"
when: not quick_refresh | bool
user:
name: "{{ autologin_user }}"
groups: disk
password: "{{ autologin_password | password_hash('sha512') }}"
shell: /bin/bash
- name: "User setup - ensure {{ autologin_user }} home folder exists"
when: not quick_refresh | bool
file:
path: "/home/{{ autologin_user }}"
state: directory
owner: "{{ autologin_user }}"
group: "{{ autologin_user }}"
mode: '0700'
- name: User setup - autologin needed stuff
when: not service_only | bool
block:
- name: User setup - update permissions on smartctl & fdisk
shell: |
chmod 755 /usr/sbin/smartctl
chmod u+s /usr/sbin/smartctl
chmod u+s /usr/sbin/fdisk
- name: User setup - create symlink for smartctl & fdisk
ignore_errors: yes
shell: |
ln /usr/sbin/smartctl /usr/bin/smartctl
ln /usr/sbin/fdisk /usr/bin/fdisk
- name: "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
...