homeserver/roles/mgrote.create_users/tasks/main.yml

43 lines
1.3 KiB
YAML
Raw Normal View History

2020-08-18 11:57:53 +02:00
- name: Erstelle Nutzer
become: yes
ansible.builtin.user:
name: "{{ create_user_name }}"
groups: "{{ create_user_groups }}"
2020-08-18 11:57:53 +02:00
state: present
shell: /bin/bash
password: "{{ create_user_password | password_hash('sha512') }}"
2020-08-18 11:57:53 +02:00
update_password: on_create
# no_log: true
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
ansible.builtin.file:
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
# 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
ansible.builtin.template:
2020-08-18 11:57:53 +02:00
src: ".selected_editor"
dest: "/home/{{ create_user_name }}/.selected_editor"
# no_log: true
# Validate the sudoers file before saving
- name: set sudo without password
become: yes
ansible.builtin.template:
src: sudoers
dest: /etc/sudoers.d/{{ create_user_name }}
validate: /usr/sbin/visudo -cf %s
# no_log: true