added admin password

This commit is contained in:
Jens Timmerman 2020-09-12 02:15:11 +02:00
parent ff6e6da87f
commit b5d97ad1eb
2 changed files with 11 additions and 2 deletions

View File

@ -11,6 +11,7 @@ This role requires a database server to to be present where im can connect to
Role Variables
--------------
- `im_admin_password`: required, password for 'admin' user for im
- `im_secret_key`: optional Secret Key for Django app, defaults to random 56char string recreated on every run (This will invalidated current open sessions)
- `im_user`: user running the app, defaults to 'im' (this user will be created)
- `im_home`: path to install the im app in, defaults to /home/im (this path will be created)
@ -37,8 +38,9 @@ Example Playbook
roles:
- ansible-role-im
vars:
- im_domain: "im.caret.be"
- im_domain: "im.example.com"
- im_http_listen: "{{inventory_hostname}}"
- im_admin_password: "test"
```
```yaml
@ -47,7 +49,7 @@ Example Playbook
roles:
- ansible-role-im
vars:
- im_domain: "im.caret.be"
- im_domain: "im.example.com"
- im_http_listen: "192.168.1.112"
```

View File

@ -85,6 +85,13 @@
become_user: "{{im_user}}"
when: superuser_exists.out.find("True") == -1
- name: "set superjuser password"
django_manage:
command: 'shell -c "from django.contrib.auth.models import User; usr = User.objects.get(username=\'admin\'); usr.set_password(\'{{im_admin_password}}\'); usr.save()"'
app_path: "{{im_home}}/im"
become: true
become_user: "{{im_user}}"
- name: 'collect static content'
django_manage:
command: "collectstatic"