1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_collection_users.git synced 2024-08-16 10:29:50 +02:00
ansible_collection_users/roles/user/tasks/user_ansible.yml

30 lines
900 B
YAML
Raw Normal View History

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') }}"
key: "{{ lookup('url', 'https://github.com/do1jlr.keys', split_lines=False) }}"
exclusive: true
- name: Add admin keys to user ansible
become true
ansible.builtin.debug:
msg: "tbd."