2017-09-17 21:25:30 +02:00
|
|
|
---
|
|
|
|
- name: List users
|
2021-05-01 17:13:18 +02:00
|
|
|
ansible.builtin.shell: 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-05-01 17:13:18 +02:00
|
|
|
ansible.builtin.shell: |
|
2021-03-10 20:28:12 +01:00
|
|
|
yunohost user create {{ item.name }} \
|
2017-09-17 21:25:30 +02:00
|
|
|
-f {{ item.firstname }} \
|
|
|
|
-l {{ item.lastname }} \
|
2021-05-01 21:58:01 +02:00
|
|
|
-d {{ item.mail_domain }} \
|
2017-09-17 21:25:30 +02:00
|
|
|
-p {{ item.pass }}
|
2021-10-12 14:27:37 +02:00
|
|
|
loop: "{{ ynh_users }}"
|
|
|
|
when: item.name not in ynh_registered_users.users.keys()
|