48
roles/setup/tasks/users/noahk.yml
Normal file
48
roles/setup/tasks/users/noahk.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
#===================================================================================================
|
||||
# ? ABOUT
|
||||
# @author : Noah Knegt
|
||||
# @email : personal@noahknegt.com
|
||||
# @repo : https://git.noahknegt.com/noah.knegt/ansible-automations
|
||||
# @createdOn : 27-02-2023
|
||||
# @description : This will setup the normal user on the machine.
|
||||
#===================================================================================================
|
||||
|
||||
---
|
||||
- name: Create the group
|
||||
group:
|
||||
name: noahk
|
||||
state: present
|
||||
|
||||
- name: Create the user
|
||||
user:
|
||||
name: noahk
|
||||
group: noahk
|
||||
groups: noahk,{{ sudo_group }}
|
||||
password: "{{ noahk_password }}"
|
||||
state: present
|
||||
shell: /bin/bash
|
||||
|
||||
- name: Add user to sudoers
|
||||
copy:
|
||||
src: noahk/noahk_sudoers
|
||||
dest: /etc/sudoers.d/noahk
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0440
|
||||
|
||||
- name: Create .ssh directory
|
||||
file:
|
||||
path: /home/noahk/.ssh
|
||||
state: directory
|
||||
owner: noahk
|
||||
group: noahk
|
||||
mode: 0700
|
||||
with_items:
|
||||
- { dir: /home/noahk/.ssh }
|
||||
|
||||
- name: Copy ssh public key
|
||||
authorized_key:
|
||||
user: noahk
|
||||
key: "{{ item }}"
|
||||
with_file:
|
||||
- noahk/noahk.pub
|
Reference in New Issue
Block a user