diff --git a/tasks/configure.yml b/tasks/configure.yml index ea144d79..57a444eb 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -22,6 +22,23 @@ - set_fact: archivematica_src_configure_ss_api_key={{ 999999999999999999999 | random | to_uuid | hash('md5') }} when: "archivematica_src_configure_ss_api_key is undefined and archivematica_src_configure_ss|bool" +- name: "Get SS API Key" + shell: > + echo "select key from tastypie_apikey where id in (select id from auth_user where username = '{{ archivematica_src_configure_ss_user }}');" + | {{ archivematica_src_ss_virtualenv }}/bin/python manage.py dbshell + args: + chdir: "{{ archivematica_src_ss_app }}" + executable: /bin/bash + environment: "{{ archivematica_src_ss_environment }}" + delegate_to: "{{ archivematica_src_configure_ss_url|urlsplit('hostname') }}" + become: yes + remote_user: "{{ archivematica_src_configure_ss_ssh_user | default('artefactual') }}" + register: archivematica_src_configure_ss_api_key_temp + when: "archivematica_src_configure_dashboard|bool and archivematica_src_configure_ss_api_key is undefined" + +- set_fact: archivematica_src_configure_ss_api_key="{{ archivematica_src_configure_ss_api_key_temp.stdout }}" + when: "archivematica_src_configure_dashboard|bool and archivematica_src_configure_ss_api_key_temp.stdout is defined" + - name: "Check for default SS user" become: "yes" shell: echo 'select username from auth_user where (id=1 and last_login is NULL and first_name="" and last_name="" and email="x@x.com" and username="test");' | {{ archivematica_src_ss_virtualenv }}/bin/python manage.py dbshell