dd
This commit is contained in:
parent
930a9d9465
commit
4da37ae51a
2 changed files with 9 additions and 11 deletions
|
@ -27,7 +27,9 @@ users:
|
||||||
- username: mg
|
- username: mg
|
||||||
password: "{{ lookup('viczem.keepass.keepass', 'mg_linux_password_hash', 'password') }}"
|
password: "{{ lookup('viczem.keepass.keepass', 'mg_linux_password_hash', 'password') }}"
|
||||||
update_password: always
|
update_password: always
|
||||||
groups: ssh, sudo
|
groups:
|
||||||
|
- ssh
|
||||||
|
- sudo
|
||||||
state: present
|
state: present
|
||||||
public_ssh_key: "{{ ssh_public_key_mg }}"
|
public_ssh_key: "{{ ssh_public_key_mg }}"
|
||||||
allow_sudo: true
|
allow_sudo: true
|
||||||
|
@ -35,7 +37,9 @@ users:
|
||||||
- username: ansible-user
|
- username: ansible-user
|
||||||
password: "{{ lookup('viczem.keepass.keepass', 'ansible_user_linux_password_hash', 'password') }}"
|
password: "{{ lookup('viczem.keepass.keepass', 'ansible_user_linux_password_hash', 'password') }}"
|
||||||
update_password: always
|
update_password: always
|
||||||
groups: ssh, sudo
|
groups:
|
||||||
|
- ssh
|
||||||
|
- sudo
|
||||||
state: present
|
state: present
|
||||||
public_ssh_key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJcBwOjanQV6sFWaTetqpl20SVe3aRzGjKbsp7hKkDCE mg@irantu
|
public_ssh_key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJcBwOjanQV6sFWaTetqpl20SVe3aRzGjKbsp7hKkDCE mg@irantu
|
||||||
allow_sudo: true
|
allow_sudo: true
|
||||||
|
|
|
@ -1,16 +1,10 @@
|
||||||
---
|
---
|
||||||
- name: set groups as list
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
groups_as_list: "{{ (((((groups_as_list | default([]) + item.groups.split(','))) | map('trim')) | list) | sort) | unique }}"
|
|
||||||
loop: '{{ users }}'
|
|
||||||
when: item.groups is defined
|
|
||||||
|
|
||||||
- name: create groups
|
- name: create groups
|
||||||
ansible.builtin.group:
|
ansible.builtin.group:
|
||||||
name: "{{ item }}"
|
name: "{{ ((item.groups) | sort) | unique }}"
|
||||||
state: present
|
state: present
|
||||||
loop: "{{ groups_as_list }}"
|
loop: '{{ users }}'
|
||||||
when: groups_as_list is defined
|
when: item.groups is defined
|
||||||
|
|
||||||
- name: create users
|
- name: create users
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
|
|
Loading…
Reference in a new issue