1
0
Fork 0
ynh-lydra-ansible-yunohost/tasks/users.yml
therojam c3f7b0355d switch -m (mail) was deprecated in favor of -d (--domaim)
also added example users w/ {{ domain }}
2021-05-01 18:33:45 +02:00

18 lines
593 B
YAML

---
- name: List users
ansible.builtin.shell: yunohost user list --output-as json
register: yunohost_registered_users_raw
changed_when: False
- name: Format json of users
ansible.builtin.set_fact: yunohost_registered_users="{{ yunohost_registered_users_raw.stdout | from_json }}"
- name: Create missing users
ansible.builtin.shell: |
yunohost user create {{ item.name }} \
-f {{ item.firstname }} \
-l {{ item.lastname }} \
-d {{ item.domain }} \
-p {{ item.pass }}
loop: "{{ yunohost.users }}"
when: item.name not in yunohost_registered_users.users.keys()