proxmox/roles/ci_user/tasks/main.yml

20 lines
559 B
YAML

- name: Create CI user
ansible.builtin.user:
name: "{{ ci_user.name }}"
groups: "{{ ci_user.groups }}"
shell: "{{ ci_user.shell }}"
state: present
create_home: yes
when: ci_user.name is defined and ci_user.name | length > 0
- name: Add SSH keys for CI user
ansible.posix.authorized_key:
user: "{{ ci_user.name }}"
state: present
key: "{{ item }}"
loop: "{{ ci_user.ssh_keys }}"
when:
- ci_user.name is defined
- ci_user.name | length > 0
- ci_user.ssh_keys is defined
- ci_user.ssh_keys | length > 0