Manage OS groups and users (including ssh keys, authorized_keys, ssh known hosts).
- RHEL8+
users_groups_present
- list of groups to create, example:
users_groups_present:
- name: testgroup
users_groups_absent
- list of groups to remove, exmaple:
users_groups_absent:
- name: testgroup
users_present
- list of users to create (including ssh keys, authorized_keys, ssh known hosts), example:
users_present:
- name: myuser
home: /mnt/myuser # optional
authorized_keys:
- "ssh-rsa some-key1"
- "ssh-rsa some-key2"
ssh_keys:
- src: /tmp/id_rsa
dest_file: id_rsa
- src: /tmp/id_rsa.pub
dest_file: id_rsa.pub
known_hosts:
- name: github.com
key: "github.com ssh-rsa some-key"
path: /mnt/myuser/.ssh/known_hosts
Collections:
ansible.builtin
ansible.posix
- hosts: my_servers
vars:
users_present:
- name: root
home: /root
authorized_keys:
- "ssh-rsa my-key"
roles:
- ansible-role-users
GPLv3
Vladimir Vasilev (@vladi-k)