ansible/roles/bank/tasks/login.yaml

52 lines
1.3 KiB
YAML

---
- name: Add user
user:
name: bank
password: $6$idklol$QrOE/21LDR0vhZBAXwgA7AvnmR6Ju4ZqzAzgeazC08i2yw9kyQjgwu.uuV692iL/cyE7AteDYUxCpcorONXom. # "bank"
home: /home/{{ bank_user }}
shell: /home/{{ bank_user }}/revbank.git/revbank
update_password: always
- name: Allow password auth for bank user
blockinfile:
path: /etc/ssh/sshd_config
insertafter: EOF
block: |-
Match User bank
PasswordAuthentication yes
notify: reload sshd
- name: Clear motd
copy:
content: ""
dest: /etc/motd
- name: Remove autologin
file:
path: /etc/systemd/system/getty@tty1.service.d/override.conf
state: absent
notify: daemon reload
when: not bank_local_tty
- when: bank_local_tty
block:
- name: Locate agetty
command: command -v agetty
register: agetty_location_cmd
- set_fact:
agetty_location: "{{ agetty_location_cmd.stdout_lines | join }}"
- name: Create getty dir
file:
path: /etc/systemd/system/getty@tty1.service.d
state: directory
- name: Autologin User
template:
src: tty_autologin.conf
dest: /etc/systemd/system/getty@tty1.service.d/override.conf
owner: root
group: root
mode: 0644
notify: daemon reload