Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - name: Deploy CSpace Code to CSpace Tomcat
- hosts: all
- tasks:
- - name: Check for existance of tenant source directory
- stat:
- path: "{{ tenant_source }}"
- register: tenant_source_register
- - name: Link application tenant resource file
- file:
- src: "~/{{ tenant_source }}/application-tenant.xml"
- dest: "~/collectionspace-source/application/tomcat-main/src/main/resources/{{ tenant_shortname }}-tenant.xml"
- state: hard
- force: true
- when: tenant_source_register.stat.exists
- - name: Create application tenant mount point
- file:
- path: collectionspace-source/application/tomcat-main/src/main/resources/tenants/{{ tenant_shortname }}
- state: directory
- when: tenant_source_register.stat.exists
- - name: Mount-bind application tenant source directory
- sudo: true
- command: >
- mount --bind
- {{ ansible_env.HOME }}/{{ tenant_source }}/application
- {{ ansible_env.HOME }}/collectionspace-source/application/tomcat-main/src/main/resources/tenants/{{ tenant_shortname }}
- args:
- creates: "{{ ansible_env.HOME }}/collectionspace-source/application/tomcat-main/src/main/resources/tenants/{{ tenant_shortname }}/settings.xml"
- when: tenant_source_register.stat.exists
- - name: Automatically mount-bind application tenant source directory on reboot
- sudo: true
- lineinfile:
- state: present
- line: "{{ ansible_env.HOME }}/{{ tenant_source }}/application {{ ansible_env.HOME }}/collectionspace-source/application/tomcat-main/src/main/resources/tenants/{{ tenant_shortname }} none bind 0 0"
- dest: "/etc/fstab"
- - name: Create services tenant mount point
- file:
- path: collectionspace-source/services/services/common/src/main/cspace/config/services/tenants/{{ tenant_shortname}}
- state: directory
- when: tenant_source_register.stat.exists
- - name: Mount-bind service tenant source directory
- sudo: true
- command: >
- mount --bind
- {{ ansible_env.HOME }}/{{ tenant_source }}/services
- {{ ansible_env.HOME }}/collectionspace-source/services/services/common/src/main/cspace/config/services/tenants/{{ tenant_shortname}}
- args:
- creates: "{{ ansible_env.HOME }}/collectionspace-source/services/services/common/src/main/cspace/config/services/tenants/{{ tenant_shortname}}/{{ tenant_shortname }}-tenant-bindings.delta.xml"
- when: tenant_source_register.stat.exists
- - name: Automatically mount-bind services tenant source directory on reboot
- sudo: true
- lineinfile:
- state: present
- line: "{{ ansible_env.HOME }}/{{ tenant_source }}/services {{ ansible_env.HOME }}/collectionspace-source/services/services/common/src/main/cspace/config/services/tenants/{{ tenant_shortname}} none bind 0 0"
- dest: "/etc/fstab"
- - name: Create ui tenant mount point
- file:
- path: collectionspace-source/ui/src/main/webapp/tenants/{{ tenant_shortname }}
- state: directory
- when: tenant_source_register.stat.exists
- - name: Mount-bind ui tenant source directory
- sudo: true
- command: >
- mount --bind
- {{ ansible_env.HOME }}/{{ tenant_source }}/ui
- {{ ansible_env.HOME }}/collectionspace-source/ui/src/main/webapp/tenants/{{ tenant_shortname }}
- args:
- creates: "{{ ansible_env.HOME }}/ccollectionspace-source/ui/src/main/webapp/tenants/{{ tenant_shortname }}/config"
- when: tenant_source_register.stat.exists
- - name: Automatically mount-bind ui tenant source directory on reboot
- sudo: true
- lineinfile:
- state: present
- line: "{{ ansible_env.HOME }}/{{ tenant_source }}/ui {{ ansible_env.HOME }}/collectionspace-source/ui/src/main/webapp/tenants/{{ tenant_shortname }} none bind 0 0"
- dest: "/etc/fstab"
- - name: Shut down CSpace Tomcat before deployment
- sudo: true
- service:
- name: cspace-tomcat
- state: stopped
- - name: Build CSpace application
- shell: source ~/bash-env && mvn clean install -DskipTests
- args:
- chdir: collectionspace-source/application
- executable: /bin/bash
- register: build_cspace_application_register
- failed_when: "'ERROR [main]' in build_cspace_application_register.stdout"
- - name: Build CSpace services
- shell: source ~/bash-env && ant deploy_services_artifacts
- args:
- chdir: collectionspace-source/services/services/JaxRsServiceProvider
- executable: /bin/bash
- register: build_cspace_services_register
- failed_when:
- - "'ERROR [main]' in build_cspace_services_register.stdout"
- - "'BUILD FAILED' in build_cspace_services_register.stdout"
- - "'Exception raised during parsing' in build_cspace_services_register.stdout"
- - name: Build CSpace ui
- shell: source ~/bash-env && mvn clean install -DskipTests
- args:
- chdir: collectionspace-source/ui
- executable: /bin/bash
- register: build_cspace_ui_register
- failed_when: "'ERROR [main]' in build_cspace_ui_register.stdout"
- - name: Start CSpace Tomcat after deployment
- sudo: true
- service:
- name: cspace-tomcat
- state: started
- - name: Wait for Tomcat to start
- wait_for:
- host: "{{ site_fqdn }}"
- port: "{{ site_port }}"
- state: started
- delay: 10
- - name: Wait for CSpace UI and get login cookie
- uri:
- url: "{{ site_protocol }}://{{ site_fqdn }}:{{ site_port }}/collectionspace/tenant/{{ tenant_shortname }}/login"
- method: POST
- body: "userid={{ web_csadmin_user}}&password={{ web_csadmin_pass }}"
- status_code: 303
- follow_redirects: none
- validate_certs: "{{ site_validate_certs | default('yes') }}"
- timeout: 120
- HEADER_Content-Type: "application/x-www-form-urlencoded"
- register: login_register
- - name: Initialize UI
- uri:
- url: "{{ site_protocol}}://{{ site_fqdn }}:{{ site_port }}/collectionspace/tenant/{{ tenant_shortname }}/init"
- method: GET
- status_code: 200
- validate_certs: "{{ site_validate_certs | default('yes') }}"
- timeout: 120
- HEADER_Cookie: "{{ login_register.set_cookie }}"
- - name: Initialize Authorities
- uri:
- url: "{{ site_protocol}}://{{ site_fqdn }}:{{ site_port }}/collectionspace/tenant/{{ tenant_shortname }}/authorities/initialise"
- method: GET
- status_code: 200
- validate_certs: "{{ site_validate_certs | default('yes') }}"
- timeout: 360
- HEADER_Cookie: "{{ login_register.set_cookie }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement