diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index d276b48..85703a2 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -52,10 +52,7 @@ icat_url: "{{ ansible_fqdn }}" # IDS server URL ids_url: "{{ ansible_fqdn }}" -# TopCat server URL -topcat_url: "{{ ansible_fqdn }}" - -# TopCat database hostname, database name, username and password +# DataGateway Download API database hostname, database name, username and password db_topcat_hostname: "localhost" topcat_database: "{{ vault_topcat_database }}" db_topcat_username: "{{ vault_db_topcat_username }}" diff --git a/hosts_all.yml b/hosts_all.yml index 619075a..5266bf5 100644 --- a/hosts_all.yml +++ b/hosts_all.yml @@ -17,5 +17,5 @@ - role: icat_server - role: ids_storage_file - role: ids_server - - role: topcat + - role: datagateway_download_api - role: dev_common diff --git a/icat_test_hosts.yml b/icat_test_hosts.yml index 1b2aa49..b135a3c 100644 --- a/icat_test_hosts.yml +++ b/icat_test_hosts.yml @@ -15,4 +15,4 @@ - role: icat_server - role: ids_storage_file - role: ids_server - - role: topcat + - role: datagateway_download_api diff --git a/roles/datagateway_download_api/defaults/main.yml b/roles/datagateway_download_api/defaults/main.yml new file mode 100644 index 0000000..c84b297 --- /dev/null +++ b/roles/datagateway_download_api/defaults/main.yml @@ -0,0 +1,3 @@ +--- + +datagateway_download_api_version: '3.0.1' diff --git a/roles/topcat/files/logback.xml b/roles/datagateway_download_api/files/logback.xml similarity index 84% rename from roles/topcat/files/logback.xml rename to roles/datagateway_download_api/files/logback.xml index b816415..8946664 100644 --- a/roles/topcat/files/logback.xml +++ b/roles/datagateway_download_api/files/logback.xml @@ -3,9 +3,9 @@ - ${HOME}/logs/topcat.log + ${HOME}/logs/datagateway-download-api.log - ${HOME}/logs/topcat.log.%d{yyyy-MM-dd}.%i.zip + ${HOME}/logs/datagateway-download-api.log.%d{yyyy-MM-dd}.%i.zip 30 tmp.json && mv tmp.json topcat.json - become: true - become_user: "{{ payara_user }}" - args: - chdir: /home/{{ payara_user }}/install/topcat - executable: /bin/bash - -- name: "Remove all facilities except LILS (the test facility)" - shell: 'cat topcat.json | jq ''{site, facilities: [ .facilities[] | select(.name == "LILS") ], plugins}'' > tmp.json && mv tmp.json topcat.json' - become: true - become_user: "{{ payara_user }}" - args: - chdir: /home/{{ payara_user }}/install/topcat - executable: /bin/bash - -- name: "Edit idsUrl in topcat.json" - shell: cat topcat.json | jq '.facilities[0].idsUrl = "https://{{ ids_url }}:8181"' > tmp.json && mv tmp.json topcat.json - become: true - become_user: "{{ payara_user }}" - args: - chdir: /home/{{ payara_user }}/install/topcat - executable: /bin/bash - -- name: "Edit icatUrl in topcat.json" - shell: cat topcat.json | jq '.facilities[0].icatUrl = "https://{{ icat_url }}:8181"' > tmp.json && mv tmp.json topcat.json - become: true - become_user: "{{ payara_user }}" - args: - chdir: /home/{{ payara_user }}/install/topcat - executable: /bin/bash - -- name: "Set authenticationTypes to [] in LILS facility in topcat.json" - shell: cat topcat.json | jq '.facilities[0].authenticationTypes = []' > tmp.json && mv tmp.json topcat.json - become: true - become_user: "{{ payara_user }}" - args: - chdir: /home/{{ payara_user }}/install/topcat - executable: /bin/bash - -- name: "Add Simple authn in topcat.json" - shell: 'cat topcat.json | jq ''.facilities[0].authenticationTypes += [{"title": "Simple", "plugin": "simple"}]'' > tmp.json && mv tmp.json topcat.json' - become: true - become_user: "{{ payara_user }}" - args: - chdir: /home/{{ payara_user }}/install/topcat - executable: /bin/bash - when: ansible_local.local.instantiations.authn_simple is defined and ansible_local.local.instantiations.authn_simple == 'true' - -- name: "Add DB authn in topcat.json" - shell: 'cat topcat.json | jq ''.facilities[0].authenticationTypes += [{"title": "DB", "plugin": "db"}]'' > tmp.json && mv tmp.json topcat.json' - become: true - become_user: "{{ payara_user }}" - args: - chdir: /home/{{ payara_user }}/install/topcat - executable: /bin/bash - when: ansible_local.local.instantiations.authn_db is defined and ansible_local.local.instantiations.authn_db == 'true' - -- name: "Add Anon authn in topcat.json" - shell: 'cat topcat.json | jq ''.facilities[0].authenticationTypes += [{"title": "Anonymous", "plugin": "anon"}]'' > tmp.json && mv tmp.json topcat.json' - become: true - become_user: "{{ payara_user }}" - args: - chdir: /home/{{ payara_user }}/install/topcat - executable: /bin/bash - when: ansible_local.local.instantiations.authn_anon is defined and ansible_local.local.instantiations.authn_anon == 'true' - -- name: "Add LDAP authn in topcat.json" - shell: 'cat topcat.json | jq ''.facilities[0].authenticationTypes += [{"title": "LDAP", "plugin": "ldap"}]'' > tmp.json && mv tmp.json topcat.json' - become: true - become_user: "{{ payara_user }}" - args: - chdir: /home/{{ payara_user }}/install/topcat - executable: /bin/bash - when: ansible_local.local.instantiations.authn_ldap is defined and ansible_local.local.instantiations.authn_ldap == 'true' - -- name: "Set http transport type in topcat.json" - shell: cat topcat.json | jq '.facilities[0].downloadTransportTypes[0].type = "http"' > tmp.json && mv tmp.json topcat.json - become: true - become_user: "{{ payara_user }}" - args: - chdir: /home/{{ payara_user }}/install/topcat - executable: /bin/bash - -- name: "Edit http download idsUrl in topcat.json" - shell: cat topcat.json | jq '.facilities[0].downloadTransportTypes[0].idsUrl = "http://{{ ids_url }}:8080"' > tmp.json && mv tmp.json topcat.json - become: true - become_user: "{{ payara_user }}" - args: - chdir: /home/{{ payara_user }}/install/topcat - executable: /bin/bash - -- name: "Set https transport type in topcat.json" - shell: cat topcat.json | jq '.facilities[0].downloadTransportTypes[1].type = "https"' > tmp.json && mv tmp.json topcat.json - become: true - become_user: "{{ payara_user }}" - args: - chdir: /home/{{ payara_user }}/install/topcat - executable: /bin/bash - -- name: "Edit https download idsUrl in topcat.json" - shell: cat topcat.json | jq '.facilities[0].downloadTransportTypes[1].idsUrl = "https://{{ ids_url }}:8181"' > tmp.json && mv tmp.json topcat.json - become: true - become_user: "{{ payara_user }}" - args: - chdir: /home/{{ payara_user }}/install/topcat - executable: /bin/bash - -- name: "Remove intermediate file" - file: - path: /home/{{ payara_user }}/install/topcat/tmp.json - state: absent - -- name: "Set mode of topcat.json" - file: - path: /home/{{ payara_user }}/install/topcat/topcat.json - mode: 0664 diff --git a/roles/topcat/tasks/installation.yml b/roles/topcat/tasks/installation.yml deleted file mode 100644 index 6434df7..0000000 --- a/roles/topcat/tasks/installation.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- - -- name: 'Setup topcat' - include_tasks: handlers/topcat-handler.yml - -- name: 'Set fact on host to record that topcat has been instantiated' - ini_file: - path: /etc/ansible/facts.d/local.fact - section: 'instantiations' - option: 'topcat' - value: 'true' - no_extra_spaces: true - create: false - -- name: 'Set fact on host to record version of topcat that has been instantiated' - ini_file: - path: /etc/ansible/facts.d/local.fact - section: 'versions' - option: 'topcat' - value: '{{ topcat_version }}' - no_extra_spaces: true - create: false - -- name: "Force ansible to regather local facts to recognise icat_lucene installation" - setup: - filter: ansible_local diff --git a/roles/topcat/tasks/main.yml b/roles/topcat/tasks/main.yml deleted file mode 100644 index d4252c2..0000000 --- a/roles/topcat/tasks/main.yml +++ /dev/null @@ -1,244 +0,0 @@ ---- -- name: "Install jq package" - package: - name: jq - state: present - -- name: "Check topcat package" - stat: - path: /home/{{ payara_user }}/downloads/topcat-{{ topcat_version }}-distro.zip - register: packageResult - -- name: "Download topcat" - community.general.maven_artifact: - repository_url: "https://repo.icatproject.org/repo" - group_id: "org.icatproject" - artifact_id: "topcat" - version: "{{ topcat_version }}" - classifier: "distro" - extension: "zip" - dest: "/home/{{ payara_user }}/downloads/topcat-{{ topcat_version }}-distro.zip" - owner: "{{ payara_user }}" - group: "{{ payara_user }}" - mode: 0664 - when: packageResult.stat.exists is defined and packageResult.stat.exists == false - -- name: 'Unarchive topcat if not installed' - unarchive: - src: /home/{{ payara_user }}/downloads/topcat-{{ topcat_version }}-distro.zip - dest: /home/{{ payara_user }}/install - remote_src: true - owner: '{{ payara_user }}' - group: '{{ payara_user }}' - when: ansible_local.local.instantiations.topcat is not defined or ansible_local.local.versions.topcat != topcat_version - -- name: "Find any war files not matching the current version" - find: - paths: /home/{{ payara_user }}/install/topcat/ - use_regex: yes - patterns: "^.*(?