Merge "Workflow input parameter update in plan-environment"
[apex-tripleo-heat-templates.git] / docker / services / pacemaker / cinder-volume.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Cinder Volume service
5
6 parameters:
7   DockerCinderVolumeImage:
8     description: image
9     type: string
10   DockerCinderConfigImage:
11     description: The container image to use for the cinder config_volume
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   # custom parameters for the Cinder volume role
40   CinderEnableIscsiBackend:
41     default: true
42     description: Whether to enable or not the Iscsi backend for Cinder
43     type: boolean
44   CinderLVMLoopDeviceSize:
45     default: 10280
46     description: The size of the loopback file used by the cinder LVM driver.
47     type: number
48
49 resources:
50
51   CinderBase:
52     type: ../../../puppet/services/cinder-volume.yaml
53     properties:
54       EndpointMap: {get_param: EndpointMap}
55       ServiceData: {get_param: ServiceData}
56       ServiceNetMap: {get_param: ServiceNetMap}
57       DefaultPasswords: {get_param: DefaultPasswords}
58       RoleName: {get_param: RoleName}
59       RoleParameters: {get_param: RoleParameters}
60
61 outputs:
62   role_data:
63     description: Role data for the Cinder Volume role.
64     value:
65       service_name: {get_attr: [CinderBase, role_data, service_name]}
66       config_settings:
67         map_merge:
68           - get_attr: [CinderBase, role_data, config_settings]
69           - tripleo::profile::pacemaker::cinder::volume_bundle::cinder_volume_docker_image: &cinder_volume_image {get_param: DockerCinderVolumeImage}
70             cinder::volume::manage_service: false
71             cinder::volume::enabled: false
72             cinder::host: hostgroup
73       step_config: ""
74       service_config_settings: {get_attr: [CinderBase, role_data, service_config_settings]}
75       # BEGIN DOCKER SETTINGS
76       puppet_config:
77         config_volume: cinder
78         puppet_tags: cinder_config,file,concat,file_line
79         step_config: {get_attr: [CinderBase, role_data, step_config]}
80         config_image: {get_param: DockerCinderConfigImage}
81       kolla_config:
82         /var/lib/kolla/config_files/cinder_volume.json:
83           command: /usr/bin/cinder-volume --config-file /usr/share/cinder/cinder-dist.conf --config-file /etc/cinder/cinder.conf
84           permissions:
85             - path: /var/log/cinder
86               owner: cinder:cinder
87               recurse: true
88       docker_config:
89         step_3:
90           cinder_volume_init_logs:
91             start_order: 0
92             image: *cinder_volume_image
93             privileged: false
94             user: root
95             volumes:
96               - /var/log/containers/cinder:/var/log/cinder
97             command: ['/bin/bash', '-c', 'chown -R cinder:cinder /var/log/cinder']
98         step_5:
99           cinder_volume_init_bundle:
100             start_order: 0
101             detach: false
102             net: host
103             user: root
104             command:
105               - '/bin/bash'
106               - '-c'
107               - str_replace:
108                   template:
109                     list_join:
110                       - '; '
111                       - - "cp -a /tmp/puppet-etc/* /etc/puppet; echo '{\"step\": 5}' > /etc/puppet/hieradata/docker.json"
112                         - "FACTER_uuid=docker puppet apply --tags file_line,concat,augeas,TAGS --debug -v -e 'CONFIG'"
113                   params:
114                     TAGS: 'pacemaker::resource::bundle,pacemaker::property,pacemaker::constraint::location'
115                     CONFIG: 'include ::tripleo::profile::base::pacemaker;include ::tripleo::profile::pacemaker::cinder::volume_bundle'
116             image: *cinder_volume_image
117             volumes:
118               - /etc/hosts:/etc/hosts:ro
119               - /etc/localtime:/etc/localtime:ro
120               - /etc/puppet:/tmp/puppet-etc:ro
121               - /usr/share/openstack-puppet/modules:/usr/share/openstack-puppet/modules:ro
122               - /etc/corosync/corosync.conf:/etc/corosync/corosync.conf:ro
123               - /dev/shm:/dev/shm:rw
124       host_prep_tasks:
125         - name: create persistent directories
126           file:
127             path: "{{ item }}"
128             state: directory
129           with_items:
130             - /var/log/containers/cinder
131             - /var/lib/cinder
132         #FIXME: all of this should be conditional on the CinderEnableIscsiBackend value being set to true
133         - name: cinder create LVM volume group dd
134           command:
135             list_join:
136             - ''
137             - - 'dd if=/dev/zero of=/var/lib/cinder/cinder-volumes bs=1 count=0 seek='
138               - str_replace:
139                   template: VALUE
140                   params:
141                     VALUE: {get_param: CinderLVMLoopDeviceSize}
142               - 'M'
143           args:
144             creates: /var/lib/cinder/cinder-volumes
145         - name: cinder create LVM volume group
146           shell: |
147             if ! losetup /dev/loop2; then
148               losetup /dev/loop2 /var/lib/cinder/cinder-volumes
149             fi
150             if ! pvdisplay | grep cinder-volumes; then
151               pvcreate /dev/loop2
152             fi
153             if ! vgdisplay | grep cinder-volumes; then
154               vgcreate cinder-volumes /dev/loop2
155             fi
156           args:
157             executable: /bin/bash
158             creates: /dev/loop2
159       upgrade_tasks:
160         - name: Stop and disable cinder_volume service
161           tags: step2
162           service: name=openstack-cinder-volume state=stopped enabled=no