2020-08-18 11:57:53 +02:00
|
|
|
- name: Erstelle Nutzer
|
|
|
|
become: yes
|
|
|
|
user:
|
2020-09-26 14:41:10 +02:00
|
|
|
name: "{{ create_user_name }}"
|
|
|
|
groups: "{{ create_user_groups }}"
|
2020-08-18 11:57:53 +02:00
|
|
|
state: present
|
|
|
|
shell: /bin/bash
|
2020-09-26 14:41:10 +02:00
|
|
|
password: "{{ create_user_password | password_hash('sha512') }}"
|
2020-08-18 11:57:53 +02:00
|
|
|
update_password: on_create
|
|
|
|
# no_log: true
|
|
|
|
|
2020-09-26 14:41:10 +02:00
|
|
|
|
2020-08-18 11:57:53 +02:00
|
|
|
|
|
|
|
- name: touch ".sudo_as_admin_successful"
|
|
|
|
become: yes
|
|
|
|
# when: sudo_as_admin_successful_existiert.stat.exists == False
|
|
|
|
file:
|
2020-09-26 14:41:10 +02:00
|
|
|
path: /home/{{ create_user_name }}/.sudo_as_admin_successful
|
2020-08-18 11:57:53 +02:00
|
|
|
state: touch
|
|
|
|
access_time: preserve
|
|
|
|
modification_time: preserve
|
2020-09-26 14:41:10 +02:00
|
|
|
# no_log: true
|
2020-08-18 11:57:53 +02:00
|
|
|
# entfernt:
|
|
|
|
# To run a command as administrator (user "root"), use "sudo <command>".
|
|
|
|
# See "man sudo_root" for details.
|
|
|
|
# unter der motd, bevor man sich das erstmal mit sudo angemeldet hat
|
|
|
|
|
|
|
|
- name: create .selected_editor
|
|
|
|
become: yes
|
|
|
|
template:
|
|
|
|
src: ".selected_editor"
|
2020-09-26 14:41:10 +02:00
|
|
|
dest: "/home/{{ create_user_name }}/.selected_editor"
|
|
|
|
# no_log: true
|
|
|
|
|
|
|
|
# Validate the sudoers file before saving
|
|
|
|
- name: set sudo without password
|
|
|
|
become: yes
|
|
|
|
template:
|
|
|
|
src: sudoers
|
|
|
|
dest: /etc/sudoers.d/{{ create_user_name }}
|
2020-10-23 12:53:30 +02:00
|
|
|
validate: /usr/sbin/visudo -cf %s
|
2020-09-26 14:41:10 +02:00
|
|
|
# no_log: true
|