Skip to content

Commit ef770d0

Browse files
author
choglundsp
authored
Merge pull request #1 from singleplatform-eng/manage_users_profiles
add profile attribute, fix syntax highlighting in User creation task
2 parents 0f83fad + 311e8e9 commit ef770d0

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

tasks/main.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
tags: ['users','configuration']
1212

1313
- name: User creation
14-
user: name="{{item.username}}"
15-
group="{{item.username if users_create_per_user_group
16-
else users_group}}"
17-
groups="{{item.groups | join(',')}}"
18-
shell={{item.shell if item.shell is defined else users_default_shell}}
19-
password="{{item.password if item.password is defined else '!'}}"
20-
comment="{{item.name}}"
21-
uid="{{item.uid}}"
22-
createhome="{{'yes' if users_create_homedirs else 'no'}}"
14+
user:
15+
name: "{{item.username}}"
16+
group: "{{item.username if users_create_per_user_group else users_group}}"
17+
groups: "{{item.groups | join(',')}}"
18+
shell: "{{item.shell if item.shell is defined else users_default_shell}}"
19+
password: "{{item.password if item.password is defined else '!'}}"
20+
comment: "{{item.name}}"
21+
uid: "{{item.uid}}"
22+
createhome: "{{'yes' if users_create_homedirs else 'no'}}"
2323
with_items: "{{users}}"
2424
tags: ['users','configuration']
2525

@@ -30,6 +30,17 @@
3030
- ssh_key
3131
tags: ['users','configuration']
3232

33+
- name: Setup user profiles
34+
blockinfile:
35+
block: "{{item.profile}}"
36+
dest: "/home/{{item.username}}/.profile"
37+
owner: "{{item.username}}"
38+
group: "{{item.username}}"
39+
mode: 0644
40+
create: true
41+
when: users_create_homedirs
42+
with_items: "{{users}}"
43+
3344
- name: Deleted user removal
3445
user: name="{{item.username}}" state=absent
3546
with_items: "{{users_deleted}}"

0 commit comments

Comments
 (0)