Skip to content

Commit

Permalink
feat: add append flag to users
Browse files Browse the repository at this point in the history
Merge branch 'append' of https://github.com/lazyfrosch/ansible-users into feature/append-flag

closes #17
  • Loading branch information
franklinkim committed Jun 21, 2017
2 parents 0c1b918 + 4203525 commit c4bffe1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Here is a list of all the default variables for this role, which are also availa
# group: staff
# password: xxxxx (a hash created with: mkpasswd)
# groups: ["adm", "www-data"]
# append: no (only append groups, leave others)
# home_mode: "0750"
# home_create: yes
# home: /path/to/user/home
Expand Down Expand Up @@ -111,6 +112,7 @@ This is an example playbook:
- username: foobar_groups
groups:
- users
append: yes
- username: foobar_groups_reset
groups: []
group: foobar_groups_reset
Expand Down
1 change: 1 addition & 0 deletions tasks/manage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
generate_ssh_key: "{{ item.ssh_key_generate | default(omit) }}"
group: "{{ omit if item.group is defined and item.group == item.username else (item.group if item.group is defined else (users_group if users_group else omit)) }}"
groups: "{{ item.groups|join(',') if item.groups is defined else users_groups|join(',')}}"
append: "{{ item.append | default(omit) }}"
password: "{{ item.password | default(omit) }}"
ssh_key_file: ".ssh/id_{{ item.ssh_key_type | default(users_ssh_key_type) }}"
ssh_key_passphrase: "{{ item.ssh_key_password | default(omit) }}"
Expand Down
1 change: 1 addition & 0 deletions tests/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- username: foobar_groups
groups:
- users
append: yes
- username: foobar_groups_reset
groups: []
group: foobar_groups_reset
Expand Down

0 comments on commit c4bffe1

Please sign in to comment.