A collection of linux roles
ansible-galaxy collection build
ansible-galaxy collection install linuxhq.linux
python3 -m venv venv
source venv/bin/activate
venv/bin/pip3 install -r requirements.txt
An example playbook utilizing roles available in this collection
- hosts: server
vars:
global_users:
- name: johnd
id: 2000
key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIRtpHq0ih6ZsXzskVMqHLc3bvCp82l1lS/V9i3wXwQQ
- name: janed
id: 2001
key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEQYZwthruEeeRtn4QE2x5xeVosMNha99UOVptoNjVbs
roles:
- role: linuxhq.linux.group
group_list:
"{{ (global_users |
json_query('[].{
name: name,
gid: id
}')) |
d([]) }}"
- role: linuxhq.linux.user
user_list:
"{{ (global_users |
json_query('[].{
name: name,
uid: id
}')) |
d([]) }}"
- role: linuxhq.linux.authorized_key
authorized_key_list:
"{{ (global_users |
json_query('[].{
user: name,
key: key,
exclusive: `true`
}')) |
d([]) }}"