Skip to content

Commit

Permalink
Add configure SS and pipeline
Browse files Browse the repository at this point in the history
This PR will use the features added by the following PRs:

-artefactual/archivematica#681
-artefactual/archivematica-storage-service#213

Specifically, this PR allows to:

a) Create a SS superuser
b) Create a dashboard admin user and register the pipeline on the SS.

To configure SS and pipeline on a deployment, the following boolean
extra-vars have to be enabled:

- archivematica_src_configure_dashboard: To create the dashboard admin user and
to register pipeline on SS
- archivematica_src_configure_ss: To create SS superuser

They are disabled by default.
  • Loading branch information
mamedin committed Jun 26, 2018
1 parent 4af0da7 commit a7004f4
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Note that if something is disabled with the [role variables](#role-variables), i
- `amsrc-pipeline-websrv`: Configure webserver
- `amsrc-devtools`: Archivematica devtools install
- `amsrc-automationtools`: Automation tools install
- `amsrc-configure`: Create SS superuser & create dashboard admin & register pipeline on SS


Dependencies
Expand Down
17 changes: 17 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ archivematica_src_install_acceptance_tests: "no"
archivematica_src_install_fixity: "no"
archivematica_src_search_enabled: "yes"

#Components to configure
archivematica_src_configure_dashboard: "no"
archivematica_src_configure_ss: "no"

# Define the type of environment: "production" or "development". The latter will deploy some extra stuff to make the development workflow easier.
archivematica_src_environment_type: "production"

Expand Down Expand Up @@ -122,3 +126,16 @@ archivematica_src_fixity_version: "master"
archivematica_src_fixity_ss_url: "http://localhost:8000"
archivematica_src_fixity_ss_user: "test"
archivematica_src_fixity_ss_apikey: "XXXX"

# Configure AM
# archivematica_src_configure_am_api_key & archivematica_src_configure_ss_api_key can be defined as vars. If not defined they will be autogenerated by the playbook
archivematica_src_configure_ss_user: "test" # SS superuser
archivematica_src_configure_ss_password: "PleaseChangeMe!" # SS superuser password
archivematica_src_configure_ss_email: "[email protected]" # SS superuser email address
archivematica_src_configure_ss_url: "http://localhost:8000" # SS url to register the pipeline
archivematica_src_configure_am_user: "test" # Dashboard admin
archivematica_src_configure_am_password: "PleaseChangeMe!" # Dashboard admin password
archivematica_src_configure_am_email: "[email protected]" # Dashboard admin password
archivematica_src_configure_am_org_name: "test org" # Dashboard admin Org name
archivematica_src_configure_am_org_id: "test id" # Dashboard admin Org id
archivematica_src_configure_am_whitelist: '""' # Dashboard API whitelist, IP address or hostnames separated by blank spaces and inside quotes
54 changes: 54 additions & 0 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
# ss-configure

# Create api-key if not defined
- 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"

# Delete default SS superuser test
- name: "Delete default SS superuser"
become: "yes"
shell: echo "from django.contrib.auth.models import User;User.objects.get(username='test').delete()" | {{ archivematica_src_ss_virtualenv }}/bin/python manage.py shell
args:
chdir: "{{ archviematica_src_ss_app }}"
executable: /bin/bash
environment: "{{ archivematica_src_ss_environment }}"
when: "archivematica_src_configure_ss|bool"

- name: "Create SS superuser"
django_manage:
command: >
create_user
--username="{{ archivematica_src_configure_ss_user }}"
--password="{{ archivematica_src_configure_ss_password }}"
--email="{{ archivematica_src_configure_ss_email }}"
--api-key="{{ archivematica_src_configure_ss_api_key }}"
--superuser
app_path: "{{ archviematica_src_ss_app }}"
virtualenv: "{{ archivematica_src_ss_virtualenv }}"
environment: "{{ archivematica_src_ss_environment }}"
when: "archivematica_src_configure_ss|bool"

# dashboard-configure

# Create api-key if not defined
- set_fact: archivematica_src_configure_am_api_key={{ 999999999999999999998 | random | to_uuid | hash('md5') }}
when: archivematica_src_configure_am_api_key is undefined

- name: "Create Dashboard user and register pipeline on SS"
django_manage:
command: >
install --username="{{ archivematica_src_configure_am_user }}"
--password="{{ archivematica_src_configure_am_password }}"
--email="{{ archivematica_src_configure_am_email }}"
--org-name="{{ archivematica_src_configure_am_org_name }}"
--org-id="{{ archivematica_src_configure_am_org_id }}"
--api-key="{{ archivematica_src_configure_am_api_key }}"
--ss-url="{{ archivematica_src_configure_ss_url }}"
--ss-user="{{ archivematica_src_configure_ss_user }}"
--ss-api-key="{{ archivematica_src_configure_ss_api_key }}"
--whitelist="{{archivematica_src_configure_am_whitelist}}"
app_path: "{{ archivematica_src_am_dashboard_app }}"
pythonpath: "{{ archivematica_src_am_common_app }}"
virtualenv: "{{ archivematica_src_am_dashboard_virtualenv }}"
when: "archivematica_src_configure_dashboard|bool"
9 changes: 9 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,12 @@
tags:
- "amsrc-fixity"
when: "archivematica_src_install_fixity|bool"

#
# Configure pipeline and SS
#

- include: "configure.yml"
tags:
- "amsrc-configure"
when: "archivematica_src_configure_ss|bool or archivematica_src_configure_dashboard|bool"

0 comments on commit a7004f4

Please sign in to comment.