Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.42 KB | None | 0 0
  1. ---
  2.  
  3. - name: Deploy CSpace Code to CSpace Tomcat
  4. hosts: all
  5. tasks:
  6.  
  7. - name: Check for existance of tenant source directory
  8. stat:
  9. path: "{{ tenant_source }}"
  10. register: tenant_source_register
  11.  
  12. - name: Link application tenant resource file
  13. file:
  14. src: "~/{{ tenant_source }}/application-tenant.xml"
  15. dest: "~/collectionspace-source/application/tomcat-main/src/main/resources/{{ tenant_shortname }}-tenant.xml"
  16. state: hard
  17. force: true
  18. when: tenant_source_register.stat.exists
  19.  
  20. - name: Create application tenant mount point
  21. file:
  22. path: collectionspace-source/application/tomcat-main/src/main/resources/tenants/{{ tenant_shortname }}
  23. state: directory
  24. when: tenant_source_register.stat.exists
  25.  
  26. - name: Mount-bind application tenant source directory
  27. sudo: true
  28. command: >
  29. mount --bind
  30. {{ ansible_env.HOME }}/{{ tenant_source }}/application
  31. {{ ansible_env.HOME }}/collectionspace-source/application/tomcat-main/src/main/resources/tenants/{{ tenant_shortname }}
  32. args:
  33. creates: "{{ ansible_env.HOME }}/collectionspace-source/application/tomcat-main/src/main/resources/tenants/{{ tenant_shortname }}/settings.xml"
  34. when: tenant_source_register.stat.exists
  35.  
  36. - name: Automatically mount-bind application tenant source directory on reboot
  37. sudo: true
  38. lineinfile:
  39. state: present
  40. 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"
  41. dest: "/etc/fstab"
  42.  
  43. - name: Create services tenant mount point
  44. file:
  45. path: collectionspace-source/services/services/common/src/main/cspace/config/services/tenants/{{ tenant_shortname}}
  46. state: directory
  47. when: tenant_source_register.stat.exists
  48.  
  49. - name: Mount-bind service tenant source directory
  50. sudo: true
  51. command: >
  52. mount --bind
  53. {{ ansible_env.HOME }}/{{ tenant_source }}/services
  54. {{ ansible_env.HOME }}/collectionspace-source/services/services/common/src/main/cspace/config/services/tenants/{{ tenant_shortname}}
  55. args:
  56. creates: "{{ ansible_env.HOME }}/collectionspace-source/services/services/common/src/main/cspace/config/services/tenants/{{ tenant_shortname}}/{{ tenant_shortname }}-tenant-bindings.delta.xml"
  57. when: tenant_source_register.stat.exists
  58.  
  59. - name: Automatically mount-bind services tenant source directory on reboot
  60. sudo: true
  61. lineinfile:
  62. state: present
  63. 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"
  64. dest: "/etc/fstab"
  65.  
  66. - name: Create ui tenant mount point
  67. file:
  68. path: collectionspace-source/ui/src/main/webapp/tenants/{{ tenant_shortname }}
  69. state: directory
  70. when: tenant_source_register.stat.exists
  71.  
  72. - name: Mount-bind ui tenant source directory
  73. sudo: true
  74. command: >
  75. mount --bind
  76. {{ ansible_env.HOME }}/{{ tenant_source }}/ui
  77. {{ ansible_env.HOME }}/collectionspace-source/ui/src/main/webapp/tenants/{{ tenant_shortname }}
  78. args:
  79. creates: "{{ ansible_env.HOME }}/ccollectionspace-source/ui/src/main/webapp/tenants/{{ tenant_shortname }}/config"
  80. when: tenant_source_register.stat.exists
  81.  
  82. - name: Automatically mount-bind ui tenant source directory on reboot
  83. sudo: true
  84. lineinfile:
  85. state: present
  86. line: "{{ ansible_env.HOME }}/{{ tenant_source }}/ui {{ ansible_env.HOME }}/collectionspace-source/ui/src/main/webapp/tenants/{{ tenant_shortname }} none bind 0 0"
  87. dest: "/etc/fstab"
  88.  
  89. - name: Shut down CSpace Tomcat before deployment
  90. sudo: true
  91. service:
  92. name: cspace-tomcat
  93. state: stopped
  94.  
  95. - name: Build CSpace application
  96. shell: source ~/bash-env && mvn clean install -DskipTests
  97. args:
  98. chdir: collectionspace-source/application
  99. executable: /bin/bash
  100. register: build_cspace_application_register
  101. failed_when: "'ERROR [main]' in build_cspace_application_register.stdout"
  102.  
  103. - name: Build CSpace services
  104. shell: source ~/bash-env && ant deploy_services_artifacts
  105. args:
  106. chdir: collectionspace-source/services/services/JaxRsServiceProvider
  107. executable: /bin/bash
  108. register: build_cspace_services_register
  109. failed_when:
  110. - "'ERROR [main]' in build_cspace_services_register.stdout"
  111. - "'BUILD FAILED' in build_cspace_services_register.stdout"
  112. - "'Exception raised during parsing' in build_cspace_services_register.stdout"
  113.  
  114. - name: Build CSpace ui
  115. shell: source ~/bash-env && mvn clean install -DskipTests
  116. args:
  117. chdir: collectionspace-source/ui
  118. executable: /bin/bash
  119. register: build_cspace_ui_register
  120. failed_when: "'ERROR [main]' in build_cspace_ui_register.stdout"
  121.  
  122. - name: Start CSpace Tomcat after deployment
  123. sudo: true
  124. service:
  125. name: cspace-tomcat
  126. state: started
  127.  
  128. - name: Wait for Tomcat to start
  129. wait_for:
  130. host: "{{ site_fqdn }}"
  131. port: "{{ site_port }}"
  132. state: started
  133. delay: 10
  134.  
  135. - name: Wait for CSpace UI and get login cookie
  136. uri:
  137. url: "{{ site_protocol }}://{{ site_fqdn }}:{{ site_port }}/collectionspace/tenant/{{ tenant_shortname }}/login"
  138. method: POST
  139. body: "userid={{ web_csadmin_user}}&password={{ web_csadmin_pass }}"
  140. status_code: 303
  141. follow_redirects: none
  142. validate_certs: "{{ site_validate_certs | default('yes') }}"
  143. timeout: 120
  144. HEADER_Content-Type: "application/x-www-form-urlencoded"
  145. register: login_register
  146.  
  147. - name: Initialize UI
  148. uri:
  149. url: "{{ site_protocol}}://{{ site_fqdn }}:{{ site_port }}/collectionspace/tenant/{{ tenant_shortname }}/init"
  150. method: GET
  151. status_code: 200
  152. validate_certs: "{{ site_validate_certs | default('yes') }}"
  153. timeout: 120
  154. HEADER_Cookie: "{{ login_register.set_cookie }}"
  155.  
  156. - name: Initialize Authorities
  157. uri:
  158. url: "{{ site_protocol}}://{{ site_fqdn }}:{{ site_port }}/collectionspace/tenant/{{ tenant_shortname }}/authorities/initialise"
  159. method: GET
  160. status_code: 200
  161. validate_certs: "{{ site_validate_certs | default('yes') }}"
  162. timeout: 360
  163. HEADER_Cookie: "{{ login_register.set_cookie }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement