2017-09-17 21:25:30 +02:00
|
|
|
---
|
|
|
|
- name: List users
|
2021-10-12 16:00:56 +02:00
|
|
|
ansible.builtin.command: yunohost user list --output-as json
|
2021-10-12 14:27:37 +02:00
|
|
|
register: ynh_registered_users_raw
|
2017-09-17 21:25:30 +02:00
|
|
|
changed_when: False
|
|
|
|
|
|
|
|
- name: Format json of users
|
2021-10-12 14:27:37 +02:00
|
|
|
ansible.builtin.set_fact: ynh_registered_users="{{ ynh_registered_users_raw.stdout | from_json }}"
|
2017-09-17 21:25:30 +02:00
|
|
|
|
2021-10-12 14:27:37 +02:00
|
|
|
- name: Create missing Yunohost users
|
2021-10-12 16:00:56 +02:00
|
|
|
ansible.builtin.command:
|
|
|
|
yunohost user create "{{ item.name }}" \
|
|
|
|
-f "{{ item.firstname }}" \
|
|
|
|
-l "{{ item.lastname }}" \
|
|
|
|
-d "{{ item.mail_domain }}" \
|
|
|
|
-p "{{ item.pass }}"
|
2021-10-12 14:27:37 +02:00
|
|
|
loop: "{{ ynh_users }}"
|
|
|
|
when: item.name not in ynh_registered_users.users.keys()
|