Skip to content

Commit

Permalink
Merge pull request #51 from singleplatform-eng/make_uid_optional
Browse files Browse the repository at this point in the history
making uid optional
  • Loading branch information
Colin Hoglund authored Jun 15, 2017
2 parents d80c4e0 + 3779574 commit f0ee28b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The following attributes are required for each user:
* username - The user's username.
* name - The full name of the user (gecos field)
* home - the home directory of the user to create (optional, defaults to /home/username)
* uid - The numeric user id for the user. This is required for uid consistency
* uid - The numeric user id for the user (optional). This is required for uid consistency
across systems.
* gid - The numeric group id for the group (optional). Otherwise, the
uid will be used
Expand All @@ -39,7 +39,7 @@ The following attributes are required for each user:
* group - optional primary group override
* groups - a list of supplementary groups for the user.
* profile - a string block for setting custom shell profiles
* ssh_key - This should be a list of ssh keys for the user. Each ssh key
* ssh_key - This should be a list of ssh keys for the user (optional). Each ssh key
should be included directly and should have no newlines.
* generate_ssh_key - Whether to generate a SSH key for the user (optional, defaults to no).

Expand Down
5 changes: 3 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

- name: Per-user group creation
group: name="{{item.username}}"
gid="{{item.gid if item.gid is defined else item.uid}}"
gid="{{item.gid | default(item.uid) | default(omit)}}"
with_items: "{{users}}"
when: "'group' not in item and users_create_per_user_group"
tags: ['users','configuration']
Expand All @@ -20,7 +20,7 @@
shell: "{{item.shell if item.shell is defined else users_default_shell}}"
password: "{{item.password if item.password is defined else '!'}}"
comment: "{{item.name if item.name is defined else ''}}"
uid: "{{item.uid}}"
uid: "{{item.uid | default(omit)}}"
home: "{{ item.home | default('/home/' + item.username) }}"
createhome: "{{'yes' if users_create_homedirs else 'no'}}"
generate_ssh_key: "{{ item.generate_ssh_key | default(omit) }}"
Expand All @@ -36,6 +36,7 @@
with_subelements:
- "{{users}}"
- ssh_key
- skip_missing: yes
tags: ['users','configuration']

- name: Setup user profiles
Expand Down

0 comments on commit f0ee28b

Please sign in to comment.