|
26 | 26 | group: '{{ dataverse.payara.group }}' |
27 | 27 | mode: '0600' |
28 | 28 |
|
29 | | -# this assumes only one S3 datastore. not completely viable any more. |
30 | | -#- name: set storage-driver-id to s3 |
31 | | -# shell: '{{ payara_dir}}/bin/asadmin create-jvm-options "-Ddataverse.files.storage-driver-id={{ s3.storage_driver_id }}"' |
32 | | - |
33 | | -- name: set s3 type to s3 |
34 | | - shell: '{{ payara_dir}}/bin/asadmin create-jvm-options "-Ddataverse.files.s3.type={{ s3.files_type }}"' |
35 | | - |
36 | | -- name: set s3 label to s3 |
37 | | - shell: '{{ payara_dir}}/bin/asadmin create-jvm-options "-Ddataverse.files.s3.label={{ s3.label }}"' |
38 | | - |
39 | | -- name: set s3 bucket name |
40 | | - shell: '{{ payara_dir}}/bin/asadmin create-jvm-options "-Ddataverse.files.s3.bucket-name={{ s3.bucket_name }}"' |
41 | | - |
42 | | -- name: set s3 url expiration minutes |
43 | | - shell: '{{ payara_dir}}/bin/asadmin create-jvm-options "-Ddataverse.files.s3.url-expiration-minutes={{ s3.url_expiration_minutes }}"' |
| 29 | +- name: set s3 settings in dataverse |
| 30 | + shell: 'asadmin-create-or-replace-option.sh "{{ item.key }}" "{{ item.value }}"' |
| 31 | + register: output |
| 32 | + changed_when: "'Command create-jvm-options executed successfully.' in output.stdout" |
| 33 | + when: |
| 34 | + - item.value is defined |
| 35 | + - item.value != '' |
| 36 | + with_items: |
| 37 | + - key: dataverse.files.storage-driver-id |
| 38 | + value: "{{ s3.storage_driver_id }}" |
| 39 | + - key: dataverse.files.s3.type |
| 40 | + value: "{{ s3.files_type }}" |
| 41 | + - key: dataverse.files.s3.label |
| 42 | + value: "{{ s3.label }}" |
| 43 | + - key: dataverse.files.s3.bucket-name |
| 44 | + value: "{{ s3.bucket_name }}" |
| 45 | + - key: dataverse.files.s3.url-expiration-minutes |
| 46 | + value: "{{ s3.url_expiration_minutes }}" |
| 47 | + - key: dataverse.files.s3.upload-redirect |
| 48 | + value: "{{ s3.upload_redirect }}" |
| 49 | + - key: dataverse.files.s3.path-style-access |
| 50 | + value: "{{ s3.path_style_access }}" |
| 51 | + - key: dataverse.files.s3.payload-signing |
| 52 | + value: "{{ s3.payload_signing }}" |
| 53 | + - key: dataverse.files.s3.chunked-encoding |
| 54 | + value: "{{ s3.chunked_encoding }}" |
| 55 | + - key: dataverse.files.s3.custom-endpoint-region |
| 56 | + value: "{{ s3.custom_endpoint_region }}" |
44 | 57 |
|
45 | 58 | # optional s3 settings |
46 | 59 |
|
47 | 60 | - name: expose custom_endpoint_url as variable |
48 | 61 | set_fact: |
49 | 62 | custom_endpoint_url: '{{ s3.custom_endpoint_url }}' |
50 | 63 |
|
| 64 | +- ansible.builtin.import_tasks: s3_custom_endpoint_url.yml |
| 65 | + when: custom_endpoint_url | length > 0 |
| 66 | + |
51 | 67 | - name: create S3 bucket |
52 | 68 | shell: |
53 | 69 | 'aws s3api create-bucket --bucket {{ s3.bucket_name }}' |
|
81 | 97 | when: (s3.download_redirect == true or s3.upload_redirect == true) |
82 | 98 | and custom_endpoint_url | length == 0 |
83 | 99 | and s3.cors_already_set == false |
84 | | - |
85 | | -- ansible.builtin.import_tasks: s3_custom_endpoint_url.yml |
86 | | - when: custom_endpoint_url | length > 0 |
87 | | - |
88 | 100 | - name: set s3 direct download |
89 | | - shell: '{{ payara_dir}}/bin/asadmin create-jvm-options "-Ddataverse.files.s3.download-redirect={{ s3.download_redirect }}"' |
90 | | - when: s3.download_redirect == true |
91 | | - |
92 | | -- name: set s3 direct upload |
93 | | - shell: '{{ payara_dir}}/bin/asadmin create-jvm-options "-Ddataverse.files.s3.upload-redirect={{ s3.upload_redirect }}"' |
94 | | - when: s3.upload_redirect == true |
95 | | - |
96 | | -- name: set s3 path style access |
97 | | - shell: '{{ payara_dir}}/bin/asadmin create-jvm-options "-Ddataverse.files.s3.path-style-access={{ s3.path_style_access }}"' |
98 | | - when: s3.path_style_access == true |
99 | | - |
100 | | -- name: set s3 payload signing |
101 | | - shell: '{{ payara_dir}}/bin/asadmin create-jvm-options "-Ddataverse.files.s3.payload-signing={{ s3.payload_signing }}"' |
102 | | - when: s3.payload_signing == true |
103 | | - |
104 | | -- name: turn chunked encoding off |
105 | | - shell: '{{ payara_dir}}/bin/asadmin create-jvm-options "-Ddataverse.files.s3.chunked-encoding={{ s3.chunked_encoding }}"' |
106 | | - when: s3.chunked_encoding == false |
| 101 | + shell: 'asadmin-create-or-replace-option.sh "dataverse.files.s3.download-redirect" "{{ s3.download_redirect }}"' |
| 102 | + register: output |
| 103 | + changed_when: "'Command create-jvm-options executed successfully.' in output.stdout" |
107 | 104 |
|
108 | | -- name: set custom endpoint region |
109 | | - shell: '{{ payara_dir}}/bin/asadmin create-jvm-options "-Ddataverse.files.s3.custom-endpoint-region={{ s3.custom_endpoint_region }}"' |
110 | | - when: s3.custom_endpoint_region is defined and s3.custom_endpoint_region != '' |
0 commit comments