Housekeeping (#23)

Housekeeping

Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: mg/ansible#23
Co-Authored-By: mg <mg@noreply.git.mgrote.net>
Co-Committed-By: mg <mg@noreply.git.mgrote.net>
This commit is contained in:
Michael Grote 2021-03-07 19:48:22 +01:00
parent e4e84d2218
commit d752ff094e
6 changed files with 0 additions and 62 deletions

View file

@ -1,13 +0,0 @@
## mgrote.create_users
### Beschreibung
erstellt Nutzer.
### Funktioniert auf
- [x] Ubuntu (>=18.04)
- [x] Debian
### Variablen + Defaults
##### Nutzer anlegen
create_user_name: 'mg'
create_user_password: 'hallowelt'
create_user_groups: 'sudo, ssh'

View file

@ -1,4 +0,0 @@
---
create_user_name: 'mg'
create_user_password: 'hallowelt'
create_user_groups: 'sudo, ssh'

View file

@ -1,42 +0,0 @@
- name: Erstelle Nutzer
become: yes
ansible.builtin.user:
name: "{{ create_user_name }}"
groups: "{{ create_user_groups }}"
state: present
shell: /bin/bash
password: "{{ create_user_password | password_hash('sha512') }}"
update_password: on_create
# no_log: true
- 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
state: touch
access_time: preserve
modification_time: preserve
# 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
ansible.builtin.template:
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

View file

@ -1,2 +0,0 @@
{{ file_header | default () }}
SELECTED_EDITOR="/usr/bin/vim"

View file

@ -1 +0,0 @@
%{{ create_user_name }} ALL=(ALL) NOPASSWD:ALL