xoxys.users/tasks/main.yml

37 lines
1.0 KiB
YAML
Raw Normal View History

2019-11-03 17:19:53 +00:00
---
- name: Include OS specific vars
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
2019-11-03 17:19:53 +00:00
vars:
params:
files:
- "{{ ansible_lsb.id | default('') | lower }}.yml"
- "{{ ansible_os_family | lower }}.yml"
paths:
- "vars"
errors: "ignore"
- name: Ensure secure defaults
ansible.builtin.include_tasks: security.yml
- name: Configure bash
ansible.builtin.include_tasks: bash.yml
- name: Configure users
ansible.builtin.include_tasks: "{{ lookup('first_found', params) }}"
2019-11-03 17:19:53 +00:00
vars:
params:
files:
- "users_{{ ansible_lsb.id | default('') | lower }}.yml"
- "users_{{ ansible_os_family | lower }}.yml"
- "users_default.yml"
paths:
- "tasks"
- name: Set authorized_key for ssh users
ansible.posix.authorized_key:
user: "{{ item.name }}"
key: "{{ item.sshkeys }}"
exclusive: True
state: present
loop: "{{ users_default_users }}"
loop_control:
label: "{{ item.name }}"
when: item.sshkeys is defined