d15c920eeb7ad3d93cb5da334a52a98b8d6e5948
[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   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerCinderBackupImage:
12     description: image
13     default: 'centos-binary-cinder-backup:latest'
14     type: string
15   DockerCinderConfigImage:
16     description: The container image to use for the cinder config_volume
17     default: 'centos-binary-cinder-api:latest'
18     type: string
19   CinderBackupBackend:
20     default: swift
21     description: The short name of the Cinder Backup backend to use.
22     type: string
23     constraints:
24     - allowed_values: ['swift', 'ceph']
25   CinderBackupRbdPoolName:
26     default: backups
27     type: string
28   CephClientUserName:
29     default: openstack
30     type: string
31   EndpointMap:
32     default: {}
33     description: Mapping of service endpoint -> protocol. Typically set
34                  via parameter_defaults in the resource registry.
35     type: json
36   ServiceNetMap:
37     default: {}
38     description: Mapping of service_name -> network name. Typically set
39                  via parameter_defaults in the resource registry.  This
40                  mapping overrides those in ServiceNetMapDefaults.
41     type: json
42   DefaultPasswords:
43     default: {}
44     type: json
45   RoleName:
46     default: ''
47     description: Role name on which the service is applied
48     type: string
49   RoleParameters:
50     default: {}
51     description: Parameters specific to the role
52     type: json
53
54
55 resources:
56
57   CinderBackupBase:
58     type: ../../../puppet/services/cinder-backup.yaml
59     properties:
60       EndpointMap: {get_param: EndpointMap}
61       ServiceNetMap: {get_param: ServiceNetMap}
62       DefaultPasswords: {get_param: DefaultPasswords}
63       RoleName: {get_param: RoleName}
64       RoleParameters: {get_param: RoleParameters}
65       CinderBackupBackend: {get_param: CinderBackupBackend}
66       CinderBackupRbdPoolName: {get_param: CinderBackupRbdPoolName}
67       CephClientUserName: {get_param: CephClientUserName}
68
69 outputs:
70   role_data:
71     description: Role data for the Cinder Backup role.
72     value:
73       service_name: {get_attr: [CinderBackupBase, role_data, service_name]}
74       config_settings:
75         map_merge:
76           - get_attr: [CinderBackupBase, role_data, config_settings]
77           - tripleo::profile::pacemaker::cinder::backup_bundle::cinder_backup_docker_image: &cinder_backup_image
78               list_join:
79                 - '/'
80                 - [ {get_param: DockerNamespace}, {get_param: DockerCinderBackupImage} ]
81             cinder::backup::manage_service: false
82             cinder::backup::enabled: false
83       step_config: ""
84       service_config_settings: {get_attr: [CinderBackupBase, role_data, service_config_settings]}
85       # BEGIN DOCKER SETTINGS
86       puppet_config:
87         config_volume: cinder
88         puppet_tags: cinder_config,file,concat,file_line
89         step_config: {get_attr: [CinderBackupBase, role_data, step_config]}
90         config_image:
91           list_join:
92             - '/'
93             - [ {get_param: DockerNamespace}, {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: Stop and disable cinder_backup service
150           tags: step2
151           service: name=openstack-cinder-backup state=stopped enabled=no