You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
968 B
YAML

---
- name: create Arch Linux-specific groups
group: name="{{ item }}" state=present system=no
with_items: "{{ arch_groups }}"
- name: create Arch Linux-specific users
user:
name: "{{ item.key }}"
group: users
groups: "{{ item.value.groups | join(',') }}"
comment: "{{ item.value.name}}"
state: present
with_dict: "{{ arch_users }}"
- name: configure ssh keys
authorized_key:
user: "{{ item.key }}"
key: "{{ lookup('file', '../pubkeys/' + item.value.ssh_key) }}"
manage_dir: yes
state: present
exclusive: yes
when: item.value.ssh_key is defined
with_dict: "{{ arch_users }}"
- name: get list of remote users
find: paths="/home" file_type="directory"
register: all_users
- name: disable ssh keys of disabled users
file: path="/home/{{ item }}/.ssh/authorized_keys" state=absent
when: item not in "{{ arch_users }}"
with_items: "{{ all_users.files | map(attribute='path') | map('basename') | list }}"