Merge "Remove empty metadata_settings from iscsid and multipathd templates"
[apex-tripleo-heat-templates.git] / docker / services / pacemaker / cinder-backup.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Cinder Backup service
5
6 parameters:
7   DockerCinderBackupImage:
8     description: image
9     type: string
10   DockerCinderConfigImage:
11     description: The container image to use for the cinder config_volume
12     type: string
13   CinderBackupBackend:
14     default: swift
15     description: The short name of the Cinder Backup backend to use.
16     type: string
17     constraints:
18     - allowed_values: ['swift', 'ceph']
19   CinderBackupRbdPoolName:
20     default: backups
21     type: string
22   CephClientUserName:
23     default: openstack
24     type: string
25   EndpointMap:
26     default: {}
27     description: Mapping of service endpoint -> protocol. Typically set
28                  via parameter_defaults in the resource registry.
29     type: json
30   ServiceData:
31     default: {}
32     description: Dictionary packing service data
33     type: json
34   ServiceNetMap:
35     default: {}
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.
39     type: json
40   DefaultPasswords:
41     default: {}
42     type: json
43   RoleName:
44     default: ''
45     description: Role name on which the service is applied
46     type: string
47   RoleParameters:
48     default: {}
49     description: Parameters specific to the role
50     type: json
51
52
53 resources:
54
55   MySQLClient:
56     type: ../../../puppet/services/database/mysql-client.yaml
57
58   CinderBackupBase:
59     type: ../../../puppet/services/cinder-backup.yaml
60     properties:
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}
70
71 outputs:
72   role_data:
73     description: Role data for the Cinder Backup role.
74     value:
75       service_name: {get_attr: [CinderBackupBase, role_data, service_name]}
76       config_settings:
77         map_merge:
78           - get_attr: [CinderBackupBase, role_data, config_settings]
79           - tripleo::profile::pacemaker::cinder::backup_bundle::cinder_backup_docker_image: &cinder_backup_image {get_param: DockerCinderBackupImage}
80             cinder::backup::manage_service: false
81             cinder::backup::enabled: false
82       step_config: ""
83       service_config_settings: {get_attr: [CinderBackupBase, role_data, service_config_settings]}
84       # BEGIN DOCKER SETTINGS
85       puppet_config:
86         config_volume: cinder
87         puppet_tags: cinder_config,file,concat,file_line
88         step_config:
89           list_join:
90             - "\n"
91             - - {get_attr: [CinderBackupBase, role_data, step_config]}
92               - {get_attr: [MySQLClient, role_data, step_config]}
93         config_image: {get_param: DockerCinderConfigImage}
94       kolla_config:
95         /var/lib/kolla/config_files/cinder_backup.json:
96           command: /usr/bin/cinder-backup --config-file /usr/share/cinder/cinder-dist.conf --config-file /etc/cinder/cinder.conf
97           permissions:
98             - path: /var/lib/cinder
99               owner: cinder:cinder
100               recurse: true
101             - path: /var/log/cinder
102               owner: cinder:cinder
103               recurse: true
104       docker_config:
105         step_3:
106           cinder_backup_init_logs:
107             start_order: 0
108             image: *cinder_backup_image
109             privileged: false
110             user: root
111             volumes:
112               - /var/log/containers/cinder:/var/log/cinder
113             command: ['/bin/bash', '-c', 'chown -R cinder:cinder /var/log/cinder']
114         step_5:
115           cinder_backup_init_bundle:
116             start_order: 1
117             detach: false
118             net: host
119             user: root
120             command:
121               - '/bin/bash'
122               - '-c'
123               - str_replace:
124                   template:
125                     list_join:
126                       - '; '
127                       - - "cp -a /tmp/puppet-etc/* /etc/puppet; echo '{\"step\": 5}' > /etc/puppet/hieradata/docker.json"
128                         - "FACTER_uuid=docker puppet apply --tags file_line,concat,augeas,TAGS --debug -v -e 'CONFIG'"
129                   params:
130                     TAGS: 'pacemaker::resource::bundle,pacemaker::property,pacemaker::constraint::location'
131                     CONFIG: 'include ::tripleo::profile::base::pacemaker;include ::tripleo::profile::pacemaker::cinder::backup_bundle'
132             image: *cinder_backup_image
133             volumes:
134               - /etc/hosts:/etc/hosts:ro
135               - /etc/localtime:/etc/localtime:ro
136               - /etc/puppet:/tmp/puppet-etc:ro
137               - /usr/share/openstack-puppet/modules:/usr/share/openstack-puppet/modules:ro
138               - /etc/corosync/corosync.conf:/etc/corosync/corosync.conf:ro
139               - /dev/shm:/dev/shm:rw
140       host_prep_tasks:
141         - name: create persistent directories
142           file:
143             path: "{{ item }}"
144             state: directory
145           with_items:
146             - /var/lib/cinder
147             - /var/log/containers/cinder
148       upgrade_tasks:
149         - name: get bootstrap nodeid
150           tags: common
151           command: hiera -c /etc/puppet/hiera.yaml bootstrap_nodeid
152           register: bootstrap_node
153         - name: set is_bootstrap_node fact
154           tags: common
155           set_fact: is_bootstrap_node={{bootstrap_node.stdout|lower == ansible_hostname|lower}}
156         - name: Disable the openstack-cinder-backup cluster resource
157           tags: step2
158           pacemaker_resource:
159             resource: openstack-cinder-backup
160             state: disable
161             wait_for_resource: true
162           when: is_bootstrap_node
163         - name: Delete the stopped openstack-cinder-backup cluster resource.
164           tags: step2
165           pacemaker_resource:
166             resource: openstack-cinder-backup
167             state: delete
168             wait_for_resource: true
169           when: is_bootstrap_node
170         - name: Disable cinder_backup service
171           tags: step2
172           service: name=openstack-cinder-backup enabled=no