|
18 | 18 |
|
19 | 19 | # ss-configure |
20 | 20 |
|
21 | | -# Create api-key if not defined |
22 | | -- set_fact: archivematica_src_configure_ss_api_key={{ 999999999999999999999 | random | to_uuid | hash('md5') }} |
23 | | - when: "archivematica_src_configure_ss_api_key is undefined and archivematica_src_configure_ss|bool" |
| 21 | +- name: "Check for SS user" |
| 22 | + become: "yes" |
| 23 | + shell: echo 'select username from auth_user where username="{{ archivematica_src_configure_ss_user }}";' | {{ archivematica_src_ss_virtualenv }}/bin/python manage.py dbshell | tail -n1 |
| 24 | + args: |
| 25 | + chdir: "{{ archivematica_src_ss_app }}" |
| 26 | + executable: /bin/bash |
| 27 | + environment: "{{ archivematica_src_ss_environment }}" |
| 28 | + register: ss_user |
| 29 | + when: archivematica_src_configure_ss|bool |
| 30 | + |
| 31 | +- debug: |
| 32 | + msg: "The SS user {{ archivematica_src_configure_ss_user }} is already configured: The SS superuser will not be created." |
| 33 | + when: archivematica_src_configure_ss|bool and ss_user.stdout != "" |
24 | 34 |
|
25 | 35 | - name: "Get SS API Key" |
26 | 36 | shell: > |
|
34 | 44 | become: yes |
35 | 45 | remote_user: "{{ archivematica_src_configure_ss_ssh_user | default('artefactual') }}" |
36 | 46 | register: archivematica_src_configure_ss_api_key_temp |
37 | | - when: "archivematica_src_configure_dashboard|bool and archivematica_src_configure_ss_api_key is undefined" |
| 47 | + when: |
| 48 | + - "archivematica_src_configure_dashboard|bool or archivematica_src_configure_ss|bool" |
| 49 | + - "archivematica_src_configure_ss_api_key is undefined" |
38 | 50 |
|
39 | 51 | - set_fact: archivematica_src_configure_ss_api_key="{{ archivematica_src_configure_ss_api_key_temp.stdout }}" |
40 | | - when: "archivematica_src_configure_dashboard|bool and archivematica_src_configure_ss_api_key_temp.stdout is defined" |
| 52 | + when: |
| 53 | + - "archivematica_src_configure_dashboard|bool" |
| 54 | + - "archivematica_src_configure_ss_api_key_temp.stdout is defined" |
41 | 55 |
|
42 | | -- name: "Check for SS user" |
43 | | - become: "yes" |
44 | | - shell: echo 'select username from auth_user where username="{{ archivematica_src_configure_ss_user }}";' | {{ archivematica_src_ss_virtualenv }}/bin/python manage.py dbshell | tail -n1 |
45 | | - args: |
46 | | - chdir: "{{ archivematica_src_ss_app }}" |
47 | | - executable: /bin/bash |
48 | | - environment: "{{ archivematica_src_ss_environment }}" |
49 | | - register: ss_user |
50 | | - when: archivematica_src_configure_ss|bool |
51 | | - |
52 | | -- debug: |
53 | | - msg: "The SS user {{ archivematica_src_configure_ss_user }} is already configured: The SS superuser will not be created." |
54 | | - when: archivematica_src_configure_ss|bool and ss_user.stdout != "" |
| 56 | +# Create api-key if not defined and SS user was not already configured |
| 57 | +- set_fact: archivematica_src_configure_ss_api_key={{ 999999999999999999999 | random | to_uuid | hash('md5') }} |
| 58 | + when: |
| 59 | + - "archivematica_src_configure_ss_api_key is undefined" |
| 60 | + - "archivematica_src_configure_ss|bool" |
55 | 61 |
|
56 | 62 | - name: "Create SS superuser" |
57 | 63 | django_manage: |
|
0 commit comments