Skip to content

Commit 949d38f

Browse files
committed
create_guest_collections.py configuration separated from script.
1 parent d3b80bb commit 949d38f

4 files changed

Lines changed: 27 additions & 196 deletions

File tree

code/examples/globus_ansible/roles/globus/tasks/guest_collections.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
2-
- name: Set guest_collection_creation_python_script fact
2+
- name: Set guest_collection_creation_config fact
33
ansible.builtin.set_fact:
4-
guest_collection_creation_python_script: "create_guest_collections_for_{{ mapped_collection_details.display_name | ansible.builtin.regex_replace('\\W+', '_') }}.py"
4+
guest_collection_creation_config: "guest_collections_config_for_{{ mapped_collection_details.display_name | ansible.builtin.regex_replace('\\W+', '_') }}.json"
55

6-
- name: "Template guest collection creation Python script {{ guest_collection_creation_python_script }}"
6+
- name: "Template guest collection creation config {{ guest_collection_creation_config }}"
77
ansible.builtin.template:
8-
src: create_guest_collections.py.j2
9-
dest: "{{ globus_config_dir }}/{{ guest_collection_creation_python_script }}"
8+
src: guest_collections_config.json.j2
9+
dest: "{{ globus_config_dir }}/{{ guest_collection_creation_config }}"
1010
owner: root
1111
group: root
1212
mode: '0600'
1313

14-
- name: "Run \"python {{ globus_config_dir }}/{{ guest_collection_creation_python_script }}\""
15-
ansible.builtin.command: "python {{ globus_config_dir }}/{{ guest_collection_creation_python_script }}"
14+
- name: "Run \"python {{ globus_config_dir }}/create_guest_collections.py {{ globus_config_dir }}/{{ guest_collection_creation_config }}\""
15+
ansible.builtin.command: "python {{ globus_config_dir }}/create_guest_collections.py {{ globus_config_dir }}/{{ guest_collection_creation_config }}"
1616
environment:
1717
GCS_CLI_ENDPOINT_ID: "{{ globus_endpoint_id }}"
1818
GCS_CLI_CLIENT_ID: "{{ globus_svc_client_id }}"

code/examples/globus_ansible/roles/globus/tasks/mapped_collection.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
ansible.builtin.set_fact:
5858
mapped_collection_details: "{{ _globus_cmd_output.stdout | from_json }}"
5959

60+
- name: Download create_guest_collections.py from GitHub URL
61+
ansible.builtin.get_url:
62+
url: "https://raw.githubusercontent.com/AARNet/Globus-Community/refs/heads/main/code/examples/create_guest_collections/create_guest_collections.py"
63+
dest: "{{ globus_config_dir }}/create_guest_collections.py"
64+
6065
- name: "Import Globus Guest Collection tasks for mapped collection \"{{ mapped_collection_details.display_name }}\""
6166
when: storage_gateway_details.id is defined and globus_endpoint_status.subscription_id != None
6267
ansible.builtin.include_tasks: "guest_collections.yml"

code/examples/globus_ansible/roles/globus/templates/create_guest_collections.py.j2

Lines changed: 0 additions & 189 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"globus_host": "{{ globus_endpoint_status.gcs_manager_url | ansible.builtin.regex_search("https://(.*)$", "\\1") | first }}",
3+
"storage_gateways": [
4+
{
5+
"storage_gateway_id": "{{ storage_gateway_details.id }}",
6+
"high_assurance": {{ storage_gateway_details.high_assurance | to_nice_json }},
7+
"mapped_collections": [
8+
{
9+
"mapped_collection_id": "{{ mapped_collection_details.id }}",
10+
"guest_collections": {{ mapped_collection_config.guest_collections | to_nice_json }}
11+
}
12+
]
13+
}
14+
]
15+
}

0 commit comments

Comments
 (0)