1 heat_template_version: pike
4 OpenStack containerized Cinder Backup service
7 DockerCinderBackupImage:
10 DockerCinderConfigImage:
11 description: The container image to use for the cinder config_volume
15 description: The short name of the Cinder Backup backend to use.
18 - allowed_values: ['swift', 'ceph']
19 CinderBackupRbdPoolName:
27 description: Mapping of service endpoint -> protocol. Typically set
28 via parameter_defaults in the resource registry.
32 description: Dictionary packing service data
36 description: Mapping of service_name -> network name. Typically set
37 via parameter_defaults in the resource registry. This
38 mapping overrides those in ServiceNetMapDefaults.
45 description: Role name on which the service is applied
49 description: Parameters specific to the role
56 type: ../../../puppet/services/database/mysql-client.yaml
59 type: ../../../puppet/services/cinder-backup.yaml
61 EndpointMap: {get_param: EndpointMap}
62 ServiceData: {get_param: ServiceData}
63 ServiceNetMap: {get_param: ServiceNetMap}
64 DefaultPasswords: {get_param: DefaultPasswords}
65 RoleName: {get_param: RoleName}
66 RoleParameters: {get_param: RoleParameters}
67 CinderBackupBackend: {get_param: CinderBackupBackend}
68 CinderBackupRbdPoolName: {get_param: CinderBackupRbdPoolName}
69 CephClientUserName: {get_param: CephClientUserName}
73 description: Role data for the Cinder Backup role.
75 service_name: {get_attr: [CinderBackupBase, role_data, service_name]}
78 - get_attr: [CinderBackupBase, role_data, config_settings]
79 - tripleo::profile::pacemaker::cinder::backup_bundle::cinder_backup_docker_image: &cinder_backup_image_pcmklatest
83 data: {get_param: DockerCinderBackupImage}
84 expression: $.data.rightSplit(separator => ":", maxSplits => 1)[0]
86 cinder::backup::manage_service: false
87 cinder::backup::enabled: false
88 logging_source: {get_attr: [CinderBackupBase, role_data, logging_source]}
89 logging_groups: {get_attr: [CinderBackupBase, role_data, logging_groups]}
91 service_config_settings: {get_attr: [CinderBackupBase, role_data, service_config_settings]}
92 # BEGIN DOCKER SETTINGS
95 puppet_tags: cinder_config,file,concat,file_line
99 - - {get_attr: [CinderBackupBase, role_data, step_config]}
100 - {get_attr: [MySQLClient, role_data, step_config]}
101 config_image: {get_param: DockerCinderConfigImage}
103 /var/lib/kolla/config_files/cinder_backup.json:
104 command: /usr/bin/cinder-backup --config-file /usr/share/cinder/cinder-dist.conf --config-file /etc/cinder/cinder.conf
106 - path: /var/lib/cinder
109 - path: /var/log/cinder
114 cinder_backup_image_tag:
124 "/usr/bin/docker tag 'CINDERBACKUP_IMAGE' 'CINDERBACKUP_IMAGE_PCMKLATEST'"
126 CINDERBACKUP_IMAGE: {get_param: DockerCinderBackupImage}
127 CINDERBACKUP_IMAGE_PCMKLATEST: *cinder_backup_image_pcmklatest
128 image: {get_param: DockerCinderBackupImage}
130 - /etc/hosts:/etc/hosts:ro
131 - /etc/localtime:/etc/localtime:ro
132 - /dev/shm:/dev/shm:rw
133 - /etc/sysconfig/docker:/etc/sysconfig/docker:ro
134 - /usr/bin:/usr/bin:ro
135 - /var/run/docker.sock:/var/run/docker.sock:rw
137 cinder_backup_init_logs:
139 image: {get_param: DockerCinderBackupImage}
143 - /var/log/containers/cinder:/var/log/cinder
144 command: ['/bin/bash', '-c', 'chown -R cinder:cinder /var/log/cinder']
146 cinder_backup_init_bundle:
158 - - "cp -a /tmp/puppet-etc/* /etc/puppet; echo '{\"step\": 5}' > /etc/puppet/hieradata/docker.json"
159 - "FACTER_uuid=docker puppet apply --tags file_line,concat,augeas,TAGS --debug -v -e 'CONFIG'"
161 TAGS: 'pacemaker::resource::bundle,pacemaker::property,pacemaker::constraint::location'
162 CONFIG: 'include ::tripleo::profile::base::pacemaker;include ::tripleo::profile::pacemaker::cinder::backup_bundle'
163 image: {get_param: DockerCinderBackupImage}
165 - /etc/hosts:/etc/hosts:ro
166 - /etc/localtime:/etc/localtime:ro
167 - /etc/puppet:/tmp/puppet-etc:ro
168 - /usr/share/openstack-puppet/modules:/usr/share/openstack-puppet/modules:ro
169 - /etc/corosync/corosync.conf:/etc/corosync/corosync.conf:ro
170 - /dev/shm:/dev/shm:rw
172 - name: create persistent directories
178 - /var/log/containers/cinder
180 - name: get bootstrap nodeid
182 command: hiera -c /etc/puppet/hiera.yaml bootstrap_nodeid
183 register: bootstrap_node
184 - name: set is_bootstrap_node fact
186 set_fact: is_bootstrap_node={{bootstrap_node.stdout|lower == ansible_hostname|lower}}
187 - name: Disable the openstack-cinder-backup cluster resource
190 resource: openstack-cinder-backup
192 wait_for_resource: true
195 until: output.rc == 0
196 when: is_bootstrap_node
197 - name: Delete the stopped openstack-cinder-backup cluster resource.
200 resource: openstack-cinder-backup
202 wait_for_resource: true
205 until: output.rc == 0
206 when: is_bootstrap_node
207 - name: Disable cinder_backup service
209 service: name=openstack-cinder-backup enabled=no
211 - name: Get docker Cinder-Backup image
213 docker_image: {get_param: DockerCinderBackupImage}
214 docker_image_latest: *cinder_backup_image_pcmklatest
216 - name: Pull latest Cinder-Backup images
217 command: "docker pull {{docker_image}}"
219 - name: Get previous Cinder-Backup image id
220 shell: "docker images | awk '/cinder-backup.* pcmklatest/{print $3}'"
221 register: cinder_backup_image_id
223 - name: Get a list of container using Cinder-Backup image
224 shell: "docker ps -q -f 'ancestor={{cinder_backup_image_id.stdout}}'"
225 register: cinder_backup_containers_to_destroy
226 # It will be recreated with the delpoy step.
227 - name: Remove any container using the same Cinder-Backup image
228 shell: "docker rm -fv {{item}}"
229 with_items: "{{ cinder_backup_containers_to_destroy.stdout_lines }}"
230 - name: Remove previous Cinder-Backup images
231 shell: "docker rmi -f {{cinder_backup_image_id.stdout}}"
234 - cinder_backup_image_id.stdout != ''
235 - name: Retag pcmklatest to latest Cinder-Backup image
236 shell: "docker tag {{docker_image}} {{docker_image_latest}}"
238 # Got to check that pacemaker_is_active is working fine with bundle.
239 # TODO: pacemaker_is_active resource doesn't support bundle.