nomad/ansible/roles/ssh/tasks/main.yml
2023-03-18 13:13:16 +00:00

32 lines
1.1 KiB
YAML

---
- include_tasks: creategroups.yml
loop: "{{ github_users }}"
loop_control:
loop_var: user_data
- name: Ensure user accounts are present
become: true
user:
name: "{{ item.user | default(item) }}"
shell: /bin/bash
createhome: true
groups: "{{ item.groups | default(item) }}"
append: yes
home: /home/{{ item.user | default(item) }}
state: present
with_items: "{{ github_users }}"
- name: Ensure authorized_keys for GitHub user accounts are present
authorized_key:
user: "{{ item.user | default(item) }}"
key: "{{ github_url }}/{{ item.account | default('') }}.keys"
manage_dir: true
exclusive: False
with_items: "{{ github_users }}"
ignore_errors: yes
register: task_result
failed_when: "'blah' in task_result"
- name: Tell user to generate openVPN configuration for users
debug:
msg: "Please generate openVPN configuration for users: {{ task_result.results | map(attribute='item') | map(attribute='user') | list | join(', ') }}. See https://docs.redbrick.dcu.ie/aperture/vpn/ for more information."