From c20ab2138b79b7ead42be60f89ceb029e39b88f8 Mon Sep 17 00:00:00 2001 From: Markus Katharina Brechtel Date: Tue, 20 Dec 2016 05:36:08 +0000 Subject: [PATCH] current --- tasks/main.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tasks/main.yml diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..d2f585f --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,29 @@ +--- + +- name: users primary group + group: + name: "{{ item.key }}" + gid: "{{ item.value.gid }}" + state: present + with_dict: "{{ users }}" + when: item.value.gid is defined + +- name: user accounts + user: + name: "{{ item.key }}" + group: "{{ item.key }}" + uid: "{{ item.value.uid }}" + password: "{{ item.value.password }}" + home: "{{ item.value.home | default('/home/'+item.key) }}" + shell: "{{ item.value.shell | default('/bin/bash') }}" + state: present + with_dict: "{{ users }}" + +- name: home directory permissions + file: + path: "{{ item.value.home | default('/home/'+item.key) }}" + owner: "{{ item.key }}" + group: "{{ item.key }}" + mode: "{{ item.homedir_mode | default(700) }}" + state: directory + with_dict: "{{ users }}"