Merge "Add a new role for ComputeOvsDpdk and clean-up parameters"
[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   CinderBackupBase:
56     type: ../../../puppet/services/cinder-backup.yaml
57     properties:
58       EndpointMap: {get_param: EndpointMap}
59       ServiceData: {get_param: ServiceData}
60       ServiceNetMap: {get_param: ServiceNetMap}
61       DefaultPasswords: {get_param: DefaultPasswords}
62       RoleName: {get_param: RoleName}
63       RoleParameters: {get_param: RoleParameters}
64       CinderBackupBackend: {get_param: CinderBackupBackend}
65       CinderBackupRbdPoolName: {get_param: CinderBackupRbdPoolName}
66       CephClientUserName: {get_param: CephClientUserName}
67
68 outputs:
69   role_data:
70     description: Role data for the Cinder Backup role.
71     value:
72       service_name: {get_attr: [CinderBackupBase, role_data, service_name]}
73       config_settings:
74         map_merge:
75           - get_attr: [CinderBackupBase, role_data, config_settings]
76           - tripleo::profile::pacemaker::cinder::backup_bundle::cinder_backup_docker_image: &cinder_backup_image {get_param: DockerCinderBackupImage}
77             cinder::backup::manage_service: false
78             cinder::backup::enabled: false
79       step_config: ""
80       service_config_settings: {get_attr: [CinderBackupBase, role_data, service_config_settings]}
81       # BEGIN DOCKER SETTINGS
82       puppet_config:
83         config_volume: cinder
84         puppet_tags: cinder_config,file,concat,file_line
85         step_config: {get_attr: [CinderBackupBase, role_data, step_config]}
86         config_image: {get_param: DockerCinderConfigImage}
87       kolla_config:
88         /var/lib/kolla/config_files/cinder_backup.json:
89           command: /usr/bin/cinder-backup --config-file /usr/share/cinder/cinder-dist.conf --config-file /etc/cinder/cinder.conf
90           permissions:
91             - path: /var/lib/cinder
92               owner: cinder:cinder
93               recurse: true
94             - path: /var/log/cinder
95               owner: cinder:cinder
96               recurse: true
97       docker_config:
98         step_3:
99           cinder_backup_init_logs:
100             start_order: 0
101             image: *cinder_backup_image
102             privileged: false
103             user: root
104             volumes:
105               - /var/log/containers/cinder:/var/log/cinder
106             command: ['/bin/bash', '-c', 'chown -R cinder:cinder /var/log/cinder']
107         step_5:
108           cinder_backup_init_bundle:
109             start_order: 1
110             detach: false
111             net: host
112             user: root
113             command:
114               - '/bin/bash'
115               - '-c'
116               - str_replace:
117                   template:
118                     list_join:
119                       - '; '
120                       - - "cp -a /tmp/puppet-etc/* /etc/puppet; echo '{\"step\": 5}' > /etc/puppet/hieradata/docker.json"
121                         - "FACTER_uuid=docker puppet apply --tags file_line,concat,augeas,TAGS --debug -v -e 'CONFIG'"
122                   params:
123                     TAGS: 'pacemaker::resource::bundle,pacemaker::property,pacemaker::constraint::location'
124                     CONFIG: 'include ::tripleo::profile::base::pacemaker;include ::tripleo::profile::pacemaker::cinder::backup_bundle'
125             image: *cinder_backup_image
126             volumes:
127               - /etc/hosts:/etc/hosts:ro
128               - /etc/localtime:/etc/localtime:ro
129               - /etc/puppet:/tmp/puppet-etc:ro
130               - /usr/share/openstack-puppet/modules:/usr/share/openstack-puppet/modules:ro
131               - /etc/corosync/corosync.conf:/etc/corosync/corosync.conf:ro
132               - /dev/shm:/dev/shm:rw
133       host_prep_tasks:
134         - name: create persistent directories
135           file:
136             path: "{{ item }}"
137             state: directory
138           with_items:
139             - /var/lib/cinder
140             - /var/log/containers/cinder
141       upgrade_tasks:
142         - name: Stop and disable cinder_backup service
143           tags: step2
144           service: name=openstack-cinder-backup state=stopped enabled=no