1
0
Fork 0
ynh-lydra-ansible-yunohost/tasks/users.yml

19 lines
582 B
YAML
Raw Normal View History

2017-09-17 21:25:30 +02:00
---
- name: List users
ansible.builtin.shell: yunohost user list --output-as json
register: ynh_registered_users_raw
2017-09-17 21:25:30 +02:00
changed_when: False
- name: Format json of users
ansible.builtin.set_fact: ynh_registered_users="{{ ynh_registered_users_raw.stdout | from_json }}"
2017-09-17 21:25:30 +02:00
- name: Create missing Yunohost users
ansible.builtin.shell: |
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 }}
loop: "{{ ynh_users }}"
when: item.name not in ynh_registered_users.users.keys()