Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 31 lines (27 sloc) 1.04 KB
---
# tasks file for ansible_role_users
- include_tasks: groups.yml
when: host_local_groups is defined
- name: Configure Groups
user:
name: "{{ item.group | default(item.name) }}"
state: "{{ item.state | default('present') }}"
loop: "{{ host_local_users|flatten(levels=1) }}"
- name: Configure Users
user:
name: "{{ item.name }}"
group: "{{ item.group| default(item.name) }}"
groups: "{{ item.groups | default(omit) }}"
comment: "{{ item.comment | default(omit) }}"
uid: "{{ item.uid | default(omit) }}"
password_lock: "{{ item.password_lock | default(omit) }}"
shell: "{{ item.shell | default('/bin/bash') }}"
state: "{{ item.state | default('present') }}"
create_home: "{{ item.createhome | default(omit) }}"
loop: "{{ host_local_users|flatten(levels=1) }}"
- name: Add public keys to authorized_hosts
authorized_key:
user: "{{ item.0.name }}"
state: "{{ item.0.state | default('present') }}"
key: "{{ item.1 }}"
loop: "{{ host_local_users | subelements('pubkeys', 'skip_missing=True') }}"
You can’t perform that action at this time.