Advertisement
fpan

opendaylight-api.yaml

Mar 12th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.37 KB | None | 0 0
  1. heat_template_version: queens
  2.  
  3. description: >
  4. OpenStack containerized OpenDaylight API service
  5.  
  6. parameters:
  7. DockerOpendaylightApiImage:
  8. description: image
  9. type: string
  10. DockerOpendaylightConfigImage:
  11. description: image
  12. type: string
  13. EndpointMap:
  14. default: {}
  15. description: Mapping of service endpoint -> protocol. Typically set
  16. via parameter_defaults in the resource registry.
  17. type: json
  18. ServiceData:
  19. default: {}
  20. description: Dictionary packing service data
  21. type: json
  22. ServiceNetMap:
  23. default: {}
  24. description: Mapping of service_name -> network name. Typically set
  25. via parameter_defaults in the resource registry. This
  26. mapping overrides those in ServiceNetMapDefaults.
  27. type: json
  28. DefaultPasswords:
  29. default: {}
  30. type: json
  31. RoleName:
  32. default: ''
  33. description: Role name on which the service is applied
  34. type: string
  35. RoleParameters:
  36. default: {}
  37. description: Parameters specific to the role
  38. type: json
  39. EnableInternalTLS:
  40. type: boolean
  41. default: false
  42. InternalTLSCAFile:
  43. default: '/etc/ipa/ca.crt'
  44. type: string
  45. description: Specifies the default CA cert to use if TLS is used for
  46. services in the internal network.
  47.  
  48. conditions:
  49.  
  50. internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
  51.  
  52. resources:
  53.  
  54. ContainersCommon:
  55. type: ./containers-common.yaml
  56.  
  57. OpenDaylightBase:
  58. type: ../../puppet/services/opendaylight-api.yaml
  59. properties:
  60. EndpointMap: {get_param: EndpointMap}
  61. ServiceData: {get_param: ServiceData}
  62. ServiceNetMap: {get_param: ServiceNetMap}
  63. DefaultPasswords: {get_param: DefaultPasswords}
  64. RoleName: {get_param: RoleName}
  65. RoleParameters: {get_param: RoleParameters}
  66.  
  67. outputs:
  68. role_data:
  69. description: Role data for the OpenDaylight API role.
  70. value:
  71. service_name: {get_attr: [OpenDaylightBase, role_data, service_name]}
  72. config_settings:
  73. map_merge:
  74. - get_attr: [OpenDaylightBase, role_data, config_settings]
  75. - if:
  76. - internal_tls_enabled
  77. - tripleo::certmonger::opendaylight::postsave_cmd: "true" # TODO: restart the odl container here
  78. - {}
  79. logging_source: {get_attr: [OpenDaylightBase, role_data, logging_source]}
  80. logging_groups: {get_attr: [OpenDaylightBase, role_data, logging_groups]}
  81. # BEGIN DOCKER SETTINGS
  82. puppet_config:
  83. config_volume: opendaylight
  84. volumes:
  85. list_concat:
  86. - if:
  87. - internal_tls_enabled
  88. - - /etc/pki/tls/certs/odl.crt:/etc/pki/tls/certs/odl.crt:ro
  89. - /etc/pki/tls/private/odl.key:/etc/pki/tls/private/odl.key:ro
  90. - list_join:
  91. - ':'
  92. - - {get_param: InternalTLSCAFile}
  93. - {get_param: InternalTLSCAFile}
  94. - 'ro'
  95. - null
  96. # 'file,concat,file_line,augeas' are included by default
  97. puppet_tags: odl_user,odl_keystore
  98. step_config:
  99. get_attr: [OpenDaylightBase, role_data, step_config]
  100. config_image: {get_param: DockerOpendaylightConfigImage}
  101. kolla_config:
  102. /var/lib/kolla/config_files/opendaylight_api.json:
  103. command: /opt/opendaylight/bin/karaf server
  104. config_files:
  105. - source: "/var/lib/kolla/config_files/src/*"
  106. dest: "/"
  107. merge: true
  108. preserve_properties: true
  109. permissions:
  110. - path: /opt/opendaylight
  111. owner: odl:odl
  112. recurse: true
  113. docker_config:
  114. step_1:
  115. opendaylight_api:
  116. start_order: 0
  117. image: &odl_api_image {get_param: DockerOpendaylightApiImage}
  118. privileged: false
  119. net: host
  120. detach: true
  121. user: odl
  122. restart: always
  123. healthcheck:
  124. test: /openstack/healthcheck
  125. volumes:
  126. list_concat:
  127. - {get_attr: [ContainersCommon, volumes]}
  128. -
  129. - /var/lib/kolla/config_files/opendaylight_api.json:/var/lib/kolla/config_files/config.json:ro
  130. - /var/lib/config-data/puppet-generated/opendaylight/:/var/lib/kolla/config_files/src:ro
  131. - /var/lib/opendaylight/journal:/opt/opendaylight/journal
  132. - /var/lib/opendaylight/snapshots:/opt/opendaylight/snapshots
  133. - /var/lib/opendaylight/etc:/opt/opendaylight/etc
  134. environment:
  135. - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
  136. metadata_settings:
  137. get_attr: [OpenDaylightBase, role_data, metadata_settings]
  138. host_prep_tasks:
  139. - name: create persistent directories
  140. file:
  141. path: "{{ item }}"
  142. state: directory
  143. with_items:
  144. - /var/lib/opendaylight/snapshots
  145. - /var/lib/opendaylight/journal
  146. - name: opendaylight logs readme
  147. copy:
  148. dest: /var/log/opendaylight/readme.txt
  149. content: |
  150. Logs from opendaylight container can be found by running "docker logs opendaylight_api"
  151. ignore_errors: true
  152. upgrade_tasks:
  153. - name: Check if opendaylight is deployed
  154. command: systemctl is-enabled --quiet opendaylight
  155. tags: common
  156. ignore_errors: True
  157. register: opendaylight_enabled
  158. - name: "PreUpgrade step0,validation: Check service opendaylight is running"
  159. command: systemctl is-active --quiet opendaylight
  160. when:
  161. - step|int == 0
  162. - opendaylight_enabled.rc == 0
  163. tags: validation
  164. - name: Stop and disable opendaylight_api service
  165. when:
  166. - step|int == 2
  167. - opendaylight_enabled.rc == 0
  168. service: name=opendaylight state=stopped enabled=no
  169. # Containarised deployment upgrade steps
  170. - name: remove journal and snapshots
  171. when: step|int == 0
  172. file:
  173. path: /var/lib/opendaylight/{{item}}
  174. state: absent
  175. with_items:
  176. - snapshots
  177. - journal
  178. - name: Set ODL upgrade flag to True
  179. copy:
  180. dest: /var/lib/opendaylight/etc/opendaylight/datastore/initial/config/genius-mdsalutil-config.xml
  181. content: |
  182. <config xmlns="urn:opendaylight:params:xml:ns:yang:mdsalutil">
  183. <upgradeInProgress>true</upgradeInProgress>
  184. </config>
  185. when: step|int == 1
  186. post_upgrade_tasks:
  187. - name: Unset upgrade flag in ODL
  188. shell:
  189. str_replace:
  190. template: 'curl -k -v --silent --fail -u ODL_USERNAME:$ODL_PASSWORD -X \
  191. PUT -d "{ "config": { "upgradeInProgress": false } }" \
  192. -H "Content-Type: application/json" \
  193. $ODL_URI/restconf/config/genius-mdsalutil:config'
  194. params:
  195. $ODL_USERNAME: {get_param: [OpenDaylightBase, OpenDaylightUsername]}
  196. $ODL_PASSWORD: {get_param: [OpenDaylightBase, OpenDaylightPassword]}
  197. $ODL_URI: {get_param: [EndpointMap, OpenDaylightInternal, uri]}
  198. when: step|int == 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement