2024-02-13 20:17:35 +01:00
|
|
|
---
|
|
|
|
- name: Create group ansible
|
|
|
|
become: true
|
|
|
|
ansible.builtin.group:
|
|
|
|
name: 'ansible'
|
|
|
|
state: "{{ l3d_users_user__ansible_user_state | ternary('present', 'absent') }}"
|
|
|
|
|
|
|
|
- name: Create user ansible
|
|
|
|
become: true
|
|
|
|
ansible.builtin.user:
|
|
|
|
name: 'ansible'
|
|
|
|
comment: 'User for ansible to login and perform tasks'
|
|
|
|
shell: '/bin/bash'
|
|
|
|
group: 'ansible'
|
|
|
|
state: "{{ l3d_users_user__ansible_user_state | ternary('present', 'absent') }}"
|
|
|
|
create_home: true
|
|
|
|
|
|
|
|
- name: Set dedicated SSH keys for User ansible and drop all other keys
|
|
|
|
become: true
|
|
|
|
ansible.posix.authorized_key:
|
|
|
|
user: 'ansible'
|
|
|
|
state: "{{ l3d_users_user__ansible_user_state | ternary('present', 'absent') }}"
|
2024-02-13 23:28:41 +01:00
|
|
|
key: "{{ l3d_users_user__ansible_ssh_keys }}"
|
2024-02-13 20:17:35 +01:00
|
|
|
exclusive: true
|
2024-02-13 23:28:41 +01:00
|
|
|
when: l3d_users_user__set_ansible_ssh_keys | bool
|
2024-02-13 20:17:35 +01:00
|
|
|
|
|
|
|
- name: Add admin keys to user ansible
|
2024-02-13 20:23:39 +01:00
|
|
|
become: true
|
2024-02-13 20:17:35 +01:00
|
|
|
ansible.builtin.debug:
|
|
|
|
msg: "tbd."
|
2024-02-13 23:28:41 +01:00
|
|
|
when: l3d_users_user__set_ansible_ssh_keys
|