Merge "Add support for Dell EMC VNX Manila Backend" into stable/pike
[apex-tripleo-heat-templates.git] / docker / services / pacemaker / manila-share.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Manila Share service
5
6 parameters:
7   DockerManilaShareImage:
8     description: image
9     type: string
10   DockerManilaConfigImage:
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
40 resources:
41
42   MySQLClient:
43     type: ../../../puppet/services/database/mysql-client.yaml
44
45   ManilaBase:
46     type: ../../../puppet/services/pacemaker/manila-share.yaml
47     properties:
48       EndpointMap: {get_param: EndpointMap}
49       ServiceNetMap: {get_param: ServiceNetMap}
50       DefaultPasswords: {get_param: DefaultPasswords}
51       RoleName: {get_param: RoleName}
52       RoleParameters: {get_param: RoleParameters}
53
54 outputs:
55   role_data:
56     description: Role data for the Manila Share role.
57     value:
58       service_name: {get_attr: [ManilaBase, role_data, service_name]}
59       config_settings:
60         map_merge:
61           - get_attr: [ManilaBase, role_data, config_settings]
62           - tripleo::profile::pacemaker::manila::share_bundle::manila_share_docker_image: &manila_share_image_pcmklatest
63               list_join:
64                 - ':'
65                 - - yaql:
66                       data: {get_param: DockerManilaShareImage}
67                       expression: $.data.rightSplit(separator => ":", maxSplits => 1)[0]
68                   - 'pcmklatest'
69             manila::share::manage_service: false
70             manila::share::enabled: false
71             manila::host: hostgroup
72       step_config: ""
73       service_config_settings: {get_attr: [ManilaBase, role_data, service_config_settings]}
74       # BEGIN DOCKER SETTINGS
75       puppet_config:
76         config_volume: manila
77         puppet_tags: manila_config,file,concat,file_line
78         step_config:
79           list_join:
80             - "\n"
81             - - {get_attr: [ManilaBase, role_data, step_config]}
82             - - {get_attr: [MySQLClient, role_data, step_config]}
83         config_image: {get_param: DockerManilaConfigImage}
84       kolla_config:
85         /var/lib/kolla/config_files/manila_share.json:
86           command: /usr/bin/manila-share --config-file /usr/share/manila/manila-dist.conf --config-file /etc/manila/manila.conf
87           config_files:
88             - source: "/var/lib/kolla/config_files/src/*"
89               dest: "/"
90               merge: true
91               preserve_properties: true
92           permissions:
93             - path: /var/log/manila
94               owner: manila:manila
95               recurse: true
96       docker_config:
97         step_1:
98           manila_share_image_tag:
99             start_order: 1
100             detach: false
101             net: host
102             user: root
103             command:
104               - '/bin/bash'
105               - '-c'
106               - str_replace:
107                   template:
108                     "/usr/bin/docker tag 'MANILASHARE_IMAGE' 'MANILASHARE_IMAGE_PCMKLATEST'"
109                   params:
110                     MANILASHARE_IMAGE: {get_param: DockerManilaShareImage}
111                     MANILASHARE_IMAGE_PCMKLATEST: *manila_share_image_pcmklatest
112             image: {get_param: DockerManilaShareImage}
113             volumes:
114               - /etc/hosts:/etc/hosts:ro
115               - /etc/localtime:/etc/localtime:ro
116               - /dev/shm:/dev/shm:rw
117               - /etc/sysconfig/docker:/etc/sysconfig/docker:ro
118               - /usr/bin:/usr/bin:ro
119               - /var/run/docker.sock:/var/run/docker.sock:rw
120         step_3:
121           manila_share_init_logs:
122             start_order: 0
123             image: {get_param: DockerManilaShareImage}
124             privileged: false
125             user: root
126             volumes:
127               - /var/log/containers/manila:/var/log/manila
128             command: ['/bin/bash', '-c', 'chown -R manila:manila /var/log/manila']
129         step_5:
130           manila_share_init_bundle:
131             start_order: 0
132             detach: false
133             net: host
134             user: root
135             command:
136               - '/bin/bash'
137               - '-c'
138               - str_replace:
139                   template:
140                     list_join:
141                       - '; '
142                       - - "cp -a /tmp/puppet-etc/* /etc/puppet; echo '{\"step\": 5}' > /etc/puppet/hieradata/docker.json"
143                         - "FACTER_uuid=docker puppet apply --tags file_line,concat,augeas,TAGS --debug -v -e 'CONFIG'"
144                   params:
145                     TAGS: 'pacemaker::resource::bundle,pacemaker::property,pacemaker::constraint::location'
146                     CONFIG: 'include ::tripleo::profile::base::pacemaker;include ::tripleo::profile::pacemaker::manila::share_bundle'
147             image: {get_param: DockerManilaShareImage}
148             volumes:
149               - /etc/hosts:/etc/hosts:ro
150               - /etc/localtime:/etc/localtime:ro
151               - /etc/puppet:/tmp/puppet-etc:ro
152               - /usr/share/openstack-puppet/modules:/usr/share/openstack-puppet/modules:ro
153               - /etc/corosync/corosync.conf:/etc/corosync/corosync.conf:ro
154               - /dev/shm:/dev/shm:rw
155       host_prep_tasks:
156         - name: create persistent directories
157           file:
158             path: "{{ item }}"
159             state: directory
160           with_items:
161             - /var/log/containers/manila
162             - /var/lib/manila
163       upgrade_tasks:
164         - name: Stop and disable manila_share service
165           tags: step2
166           service: name=openstack-manila-share state=stopped enabled=no