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
|
2017-09-17 21:25:30 +02:00
|
|
|
register: yunohost_registered_users_raw
|
|
|
|
changed_when: False
|
|
|
|
|
|
|
|
- name: Format json of users
|
2021-05-01 17:13:18 +02:00
|
|
|
ansible.builtin.set_fact: yunohost_registered_users="{{ yunohost_registered_users_raw.stdout | from_json }}"
|
2017-09-17 21:25:30 +02:00
|
|
|
|
|
|
|
- name: Create missing 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 18:33:45 +02:00
|
|
|
-d {{ item.domain }} \
|
2017-09-17 21:25:30 +02:00
|
|
|
-p {{ item.pass }}
|
2021-05-01 17:13:18 +02:00
|
|
|
loop: "{{ yunohost.users }}"
|
2017-09-17 21:25:30 +02:00
|
|
|
when: item.name not in yunohost_registered_users.users.keys()
|