diff --git a/README.md b/README.md index 4125809..77b9928 100644 --- a/README.md +++ b/README.md @@ -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" ``` diff --git a/tasks/main.yml b/tasks/main.yml index 0b5cfc7..fac5451 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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"