Commit cc0f6207 by Shirley He

add admin to list of users to be created

parent b35ed176
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
# Overview: # Overview:
# This playbook ensures that the specified users and groups exist in the targeted # This playbook ensures that the specified users and groups exist in the targeted
# edxapp cluster. # edxapp cluster.
# #
# Users have the following properties: # Users have the following properties:
# - username (required, str) # - username (required, str)
...@@ -72,7 +72,6 @@ ...@@ -72,7 +72,6 @@
# for perm in Permission.objects.all(): # for perm in Permission.objects.all():
# print '{}:{}:{}'.format(perm.content_type.app_label, perm.content_type.model, perm.codename) # print '{}:{}:{}'.format(perm.content_type.app_label, perm.content_type.model, perm.codename)
# #
- hosts: all - hosts: all
vars: vars:
python_path: /edx/bin/python.edxapp python_path: /edx/bin/python.edxapp
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
# #
DEMO_CREATE_STAFF_USER: true DEMO_CREATE_STAFF_USER: true
DEMO_CREATE_ADMIN_USER: true
demo_app_dir: "{{ COMMON_APP_DIR }}/demo" demo_app_dir: "{{ COMMON_APP_DIR }}/demo"
demo_code_dir: "{{ demo_app_dir }}/edx-demo-course" demo_code_dir: "{{ demo_app_dir }}/edx-demo-course"
...@@ -37,6 +38,12 @@ demo_staff_user: ...@@ -37,6 +38,12 @@ demo_staff_user:
username: staff username: staff
hashed_password: "{{ demo_hashed_password }}" hashed_password: "{{ demo_hashed_password }}"
is_staff: true is_staff: true
demo_admin_user:
email: 'admin@example.com'
username: admin
hashed_password: "{{ demo_hashed_password }}"
is_staff: true
is_superuser: true
demo_edxapp_user: 'edxapp' demo_edxapp_user: 'edxapp'
demo_edxapp_settings: '{{ COMMON_EDXAPP_SETTINGS }}' demo_edxapp_settings: '{{ COMMON_EDXAPP_SETTINGS }}'
demo_edxapp_venv_bin: '{{ COMMON_APP_DIR }}/{{ demo_edxapp_user }}/venvs/{{demo_edxapp_user}}/bin' demo_edxapp_venv_bin: '{{ COMMON_APP_DIR }}/{{ demo_edxapp_user }}/venvs/{{demo_edxapp_user}}/bin'
......
...@@ -26,12 +26,22 @@ ...@@ -26,12 +26,22 @@
demo_test_and_staff_users: "{{ demo_test_users }}" demo_test_and_staff_users: "{{ demo_test_users }}"
when: not DEMO_CREATE_STAFF_USER when: not DEMO_CREATE_STAFF_USER
- name: build staff, admin, and test user list
set_fact:
demo_test_admin_and_staff_users: "{{demo_test_and_staff_users + [demo_admin_user] }}"
when: DEMO_CREATE_ADMIN_USER
- name: build staff, admin, and test user list
set_fact:
demo_test_admin_and_staff_users: "{{demo_test_and_staff_users }}"
when: not DEMO_CREATE_ADMIN_USER
- name: create some test users - name: create some test users
shell: "{{ demo_edxapp_venv_bin }}/python ./manage.py lms --settings={{ demo_edxapp_settings }} --service-variant lms manage_user {{ item.username}} {{ item.email }} --initial-password-hash {{ item.hashed_password | quote }}{% if item.is_staff %} --staff{% endif %}" shell: "{{ demo_edxapp_venv_bin }}/python ./manage.py lms --settings={{ demo_edxapp_settings }} --service-variant lms manage_user {{ item.username}} {{ item.email }} --initial-password-hash {{ item.hashed_password | quote }}{% if item.is_staff %} --staff{% endif %}{% if item.is_superuser %} --superuser{% endif %}"
args: args:
chdir: "{{ demo_edxapp_code_dir }}" chdir: "{{ demo_edxapp_code_dir }}"
become_user: "{{ common_web_user }}" become_user: "{{ common_web_user }}"
with_items: "{{ demo_test_and_staff_users }}" with_items: "{{ demo_test_admin_and_staff_users }}"
when: demo_checkout.changed when: demo_checkout.changed
- name: enroll test users in the demo course - name: enroll test users in the demo course
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment