2016-02-19 17:48:53 +00:00
|
|
|
---
|
2016-12-28 13:58:37 +00:00
|
|
|
- name: User | Create Certificate Access Groups
|
|
|
|
group: name={{ item }} system=yes
|
|
|
|
with_items: "{{ user.groups.split(',') }}"
|
|
|
|
|
2016-01-23 17:01:18 +00:00
|
|
|
- name: User | Create User Group
|
2016-05-22 22:25:52 +00:00
|
|
|
group: name={{user.group|default(user.name)}} system={{user.system|default(omit)}}
|
2016-01-23 17:01:18 +00:00
|
|
|
|
2016-12-28 13:58:37 +00:00
|
|
|
- name: User | Create cloud-init user
|
|
|
|
template:
|
|
|
|
dest: /etc/{{ user.name }}_user_cloud_init_conf
|
|
|
|
src: users.j2
|
|
|
|
owner: root
|
|
|
|
mode: 0640
|
|
|
|
notify: User | update users for cloud-init
|
|
|
|
when: "{{ user.type|default('standard') == 'cloud-init' }}"
|
|
|
|
|
|
|
|
- meta: flush_handlers
|
|
|
|
|
|
|
|
- name: User | Hack groups for existing cloud-init users CoreOS
|
|
|
|
command: /usr/sbin/usermod -aG {{ item }} {{ user.name }}
|
|
|
|
with_items: "{{ user.groups.split(',') }}"
|
|
|
|
when: "{{ ansible_os_family in ['CoreOS', 'Container Linux by CoreOS'] and user.type|default('standard') == 'cloud-init' }}"
|
|
|
|
|
2016-01-23 17:01:18 +00:00
|
|
|
- name: User | Create User
|
|
|
|
user:
|
2016-05-22 22:25:52 +00:00
|
|
|
comment: "{{user.comment|default(omit)}}"
|
2016-12-28 13:58:37 +00:00
|
|
|
createhome: "{{user.createhome|default(omit)}}"
|
2016-05-22 22:25:52 +00:00
|
|
|
group: "{{user.group|default(user.name)}}"
|
2016-12-28 13:58:37 +00:00
|
|
|
groups: "{{user.groups|default(omit)}}"
|
2016-05-22 22:25:52 +00:00
|
|
|
home: "{{user.home|default(omit)}}"
|
|
|
|
shell: "{{user.shell|default(omit)}}"
|
|
|
|
name: "{{user.name}}"
|
|
|
|
system: "{{user.system|default(omit)}}"
|
2016-12-28 13:58:37 +00:00
|
|
|
when: "{{ user.type|default('standard') != 'cloud-init' }}"
|