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

47 lines
1.3 KiB
YAML
Raw Normal View History

2020-08-18 11:57:53 +02:00
- name: Erstelle Nutzer
become: yes
user:
name: "{{ item.name }}"
groups: "{{ item.groups }}"
state: present
shell: /bin/bash
password: "{{ item.password | password_hash('sha512') }}"
update_password: on_create
loop: "{{ base_users }}"
no_log: true
# - name: check if sudo file exists
# become: yes
# stat:
# path: "/home/{{ item.name }}/.sudo_as_admin_successful"
# loop: "{{ base_users }}"
# no_log: true
# register: "sudo_as_admin_successful_existiert"
# - name: dbug
# debug:
# msg: "{{ sudo_as_admin_successful_existiert }}"
- name: touch ".sudo_as_admin_successful"
become: yes
# when: sudo_as_admin_successful_existiert.stat.exists == False
file:
path: /home/{{ item.name }}/.sudo_as_admin_successful
state: touch
access_time: preserve
modification_time: preserve
loop: "{{ base_users }}"
no_log: true
# 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"
dest: "/home/{{ item.name }}/.selected_editor"
loop: "{{ base_users }}"
no_log: true