Add support for users
This commit is contained in:
parent
9d44c18172
commit
946aecd75f
4 changed files with 30 additions and 0 deletions
|
@ -32,6 +32,13 @@ yunohost:
|
||||||
args: # Provide here args. Path and domain are mandatory, other args depend of the app (cf manifest.json of app).
|
args: # Provide here args. Path and domain are mandatory, other args depend of the app (cf manifest.json of app).
|
||||||
path: /ttrss
|
path: /ttrss
|
||||||
domain: example.com
|
domain: example.com
|
||||||
|
# The list of users.
|
||||||
|
users:
|
||||||
|
- name: admin
|
||||||
|
pass: p@ssw0rd
|
||||||
|
firstname: admin
|
||||||
|
lastname: admin
|
||||||
|
mail: admin@example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
Dependencies
|
Dependencies
|
||||||
|
|
|
@ -5,3 +5,4 @@ yunohost:
|
||||||
password: MYINSECUREPWD_PLZ_OVERRIDE_THIS
|
password: MYINSECUREPWD_PLZ_OVERRIDE_THIS
|
||||||
ignore_dyndns: False
|
ignore_dyndns: False
|
||||||
apps: ~
|
apps: ~
|
||||||
|
users: ~
|
||||||
|
|
|
@ -38,6 +38,10 @@
|
||||||
shell: yunohost domain cert-install
|
shell: yunohost domain cert-install
|
||||||
changed_when: False
|
changed_when: False
|
||||||
|
|
||||||
|
- name: Add users
|
||||||
|
include: users.yml
|
||||||
|
when: yunohost.users
|
||||||
|
|
||||||
- name: Install apps
|
- name: Install apps
|
||||||
include: apps.yml
|
include: apps.yml
|
||||||
when: yunohost.apps
|
when: yunohost.apps
|
||||||
|
|
18
tasks/users.yml
Normal file
18
tasks/users.yml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
- name: List users
|
||||||
|
shell: yunohost user list --output-as json
|
||||||
|
register: yunohost_registered_users_raw
|
||||||
|
changed_when: False
|
||||||
|
|
||||||
|
- name: Format json of users
|
||||||
|
set_fact: yunohost_registered_users="{{ yunohost_registered_users_raw.stdout | from_json }}"
|
||||||
|
|
||||||
|
- name: Create missing users
|
||||||
|
shell: |
|
||||||
|
yunohost user create {{ item.name }} --admin-password {{ yunohost.password }} \
|
||||||
|
-f {{ item.firstname }} \
|
||||||
|
-l {{ item.lastname }} \
|
||||||
|
-m {{ item.mail }} \
|
||||||
|
-p {{ item.pass }}
|
||||||
|
with_items: "{{ yunohost.users }}"
|
||||||
|
when: item.name not in yunohost_registered_users.users.keys()
|
Loading…
Reference in a new issue