Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swift storage support #301

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,21 @@ s3:
payload_signing: false
chunked_encoding: true

swift:
enabled: false
is_default: false
label: swift
defaultEndpoint: endpoint1
authType:
authUrl:
tenant:
username:
endpoint:
password:
folderPathSeparator: '-'
hashKey:
temporaryUrlExpiryTime: 3600

schemaspy:
enabled: false
jarurl: https://github.com/schemaspy/schemaspy/releases/download/v6.1.0/schemaspy-6.1.0.jar
Expand Down
5 changes: 5 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@
tags:
- s3

- ansible.builtin.import_tasks: swift.yml
when: swift.enabled == true
tags:
- swift

- ansible.builtin.import_tasks: localstack_create.yml
when: localstack.enabled == true
tags:
Expand Down
43 changes: 43 additions & 0 deletions tasks/swift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---

- name: define swift storage type
shell: 'asadmin-create-or-replace-option.sh "dataverse.files.{{ swift.label }}.type" "swift"'
register: output
changed_when: "'Command create-jvm-options executed successfully.' in output.stdout"

- name: set default swift parameters for {{ swift.label }}
shell: 'asadmin-create-or-replace-option.sh "dataverse.files.{{ swift.label }}.{{ item }}" "{{ swift[item] }}"'
register: output
changed_when: "'Command create-jvm-options executed successfully.' in output.stdout"
with_items:
- label
- defaultEndpoint
- folderPathSeparator
- temporaryUrlExpiryTime

- name: set swift parameters for default endpoint
shell: 'asadmin-create-or-replace-option.sh "dataverse.files.{{ swift.label }}.{{ item }}.{{ swift.defaultEndpoint }}" "{{ swift[item] }}"'
register: output
changed_when: "'Command create-jvm-options executed successfully.' in output.stdout"
when: item != ''
with_items:
- authType
- authUrl
- tenant
- username
- endpoint
- hashKey

- name: set default storage driver id, if applicable
shell: 'asadmin-create-or-replace-option.sh "dataverse.files.storage-driver-id" "{{ swift.label }}"'
register: output
changed_when: "'Command create-jvm-options executed successfully.' in output.stdout"
when: swift.is_default

- name: set password alias name
shell: "asadmin-create-or-replace-option.sh \"dataverse.files.{{ swift.label }}.password.{{ swift.defaultEndpoint }}\" \"'\\${ALIAS=swiftpassword-alias}'\""
register: output
changed_when: "'Command create-jvm-options executed successfully.' in output.stdout"

- name: set password alias -- we cannot determine if the password has changed or not since the last run, so we always change it -- this is due to asadmin
shell: 'asadmin-create-or-replace-password-alias.sh "swiftpassword-alias" "{{ swift.password }}"'