diff --git a/ansible/roles/users/tasks/main.yml b/ansible/roles/users/tasks/main.yml index 5944aa0..e2af29d 100644 --- a/ansible/roles/users/tasks/main.yml +++ b/ansible/roles/users/tasks/main.yml @@ -11,12 +11,20 @@ ansible.builtin.user: name: "{{ item.name }}" home: /home/{{ item.name }} + uid: "{{ item.uid }}" shell: '{{ bash_path }}' groups: sudo append: true state: present with_items: "{{ user_details }}" +- name: All hosts | Create the groups + ansible.builtin.group: + name: "{{ item.name }}" + gid: "{{ item.uid }}" + state: present + with_items: "{{ user_details }}" + - name: All hosts | Set up home directory permissions for users ansible.builtin.file: path: /home/{{ item.name }} @@ -33,13 +41,6 @@ mode: 0700 with_items: "{{ user_details }}" -#- name: All hosts | Add ssh keys for allowing connections -# ansible.builtin.template: -# src: authorized_keys -# dest: /home/vinishor/.ssh/authorized_keys -# owner: vinishor -# mode: 0600 - - name: Linux | Correct sudoers file permissions for ansible user ansible.builtin.file: path: "/etc/sudoers.d/ansible" diff --git a/ansible/roles/users/vars/debian.yml b/ansible/roles/users/vars/debian.yml index bfdd4d8..690851f 100644 --- a/ansible/roles/users/vars/debian.yml +++ b/ansible/roles/users/vars/debian.yml @@ -1,7 +1,8 @@ --- user_details: - - { name: vincent } - - { name: mirsal } - - { name: jerome } - - { name: sofian } + - { name: vinishor, uid: 2000 } + - { name: mirsal, uid: 2001 } + - { name: jerome, uid: 2002 } + - { name: sofian, uid: 2003 } + - { name: epickiwi, uid: 2005 }