Add playbook for matej-server to create godan user with sudo and SSH key
This commit is contained in:
24
playbooks/hosts/matej-server.yml
Normal file
24
playbooks/hosts/matej-server.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: Create godan user
|
||||
ansible.builtin.user:
|
||||
name: godan
|
||||
state: present
|
||||
create_home: yes
|
||||
shell: /bin/bash
|
||||
become: yes
|
||||
|
||||
- name: Add godan user to sudo group
|
||||
ansible.builtin.user:
|
||||
name: godan
|
||||
groups: sudo
|
||||
append: yes
|
||||
become: yes
|
||||
|
||||
- name: Add SSH authorized key for godan user
|
||||
ansible.posix.authorized_key:
|
||||
user: godan
|
||||
state: present
|
||||
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOBa7padbnxWe1Ct5jguWdJ1rhRrDqk6m6xJA0OJzkQv"
|
||||
become: yes
|
||||
Reference in New Issue
Block a user