Merge "Add os-collect-config data as an output"
[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   # we configure all cinder services in the same cinder base container
16   DockerCinderConfigImage:
17     description: image
18     default: 'centos-binary-cinder-api:latest'
19     type: string
20   CinderBackupBackend:
21     default: swift
22     description: The short name of the Cinder Backup backend to use.
23     type: string
24     constraints:
25     - allowed_values: ['swift', 'ceph']
26   CinderBackupRbdPoolName:
27     default: backups
28     type: string
29   CephClientUserName:
30     default: openstack
31     type: string
32   EndpointMap:
33     default: {}
34     description: Mapping of service endpoint -> protocol. Typically set
35                  via parameter_defaults in the resource registry.
36     type: json
37   ServiceNetMap:
38     default: {}
39     description: Mapping of service_name -> network name. Typically set
40                  via parameter_defaults in the resource registry.  This
41                  mapping overrides those in ServiceNetMapDefaults.
42     type: json
43   DefaultPasswords:
44     default: {}
45     type: json
46   RoleName:
47     default: ''
48     description: Role name on which the service is applied
49     type: string
50   RoleParameters:
51     default: {}
52     description: Parameters specific to the role
53     type: json
54
55
56 resources:
57
58   CinderBackupBase:
59     type: ../../../puppet/services/cinder-backup.yaml
60     properties:
61       EndpointMap: {get_param: EndpointMap}
62       ServiceNetMap: {get_param: ServiceNetMap}
63       DefaultPasswords: {get_param: DefaultPasswords}
64       RoleName: {get_param: RoleName}
65       RoleParameters: {get_param: RoleParameters}
66       CinderBackupBackend: {get_param: CinderBackupBackend}
67       CinderBackupRbdPoolName: {get_param: CinderBackupRbdPoolName}
68       CephClientUserName: {get_param: CephClientUserName}
69
70 outputs:
71   role_data:
72     description: Role data for the Cinder Backup role.
73     value:
74       service_name: {get_attr: [CinderBackupBase, role_data, service_name]}
75       config_settings:
76         map_merge:
77           - get_attr: [CinderBackupBase, role_data, config_settings]
78           - tripleo::profile::pacemaker::cinder::backup_bundle::cinder_backup_docker_image: &cinder_backup_image
79               list_join:
80                 - '/'
81                 - [ {get_param: DockerNamespace}, {get_param: DockerCinderBackupImage} ]
82             cinder::backup::manage_service: false
83             cinder::backup::enabled: false
84       step_config: ""
85       service_config_settings: {get_attr: [CinderBackupBase, role_data, service_config_settings]}
86       # BEGIN DOCKER SETTINGS
87       puppet_config:
88         config_volume: cinder
89         puppet_tags: cinder_config,file,concat,file_line
90         step_config: {get_attr: [CinderBackupBase, role_data, step_config]}
91         config_image:
92           list_join:
93             - '/'
94             - [ {get_param: DockerNamespace}, {get_param: DockerCinderConfigImage} ]
95       kolla_config:
96         /var/lib/kolla/config_files/cinder_backup.json:
97           command: /usr/bin/cinder-backup --config-file /usr/share/cinder/cinder-dist.conf --config-file /etc/cinder/cinder.conf
98           permissions:
99             - path: /var/lib/cinder
100               owner: cinder:cinder
101               recurse: true
102             - path: /var/log/cinder
103               owner: cinder:cinder
104               recurse: true
105       docker_config:
106         step_3:
107           cinder_backup_init_logs:
108             start_order: 0
109             image: *cinder_backup_image
110             privileged: false
111             user: root
112             volumes:
113               - /var/log/containers/cinder:/var/log/cinder
114             command: ['/bin/bash', '-c', 'chown -R cinder:cinder /var/log/cinder']
115         step_5:
116           cinder_backup_init_bundle:
117             start_order: 1
118             detach: false
119             net: host
120             user: root
121             command:
122               - '/bin/bash'
123               - '-c'
124               - str_replace:
125                   template:
126                     list_join:
127                       - '; '
128                       - - "cp -a /tmp/puppet-etc/* /etc/puppet; echo '{\"step\": 5}' > /etc/puppet/hieradata/docker.json"
129                         - "FACTER_uuid=docker puppet apply --tags file_line,concat,augeas,TAGS --debug -v -e 'CONFIG'"
130                   params:
131                     TAGS: 'pacemaker::resource::bundle,pacemaker::property,pacemaker::constraint::location'
132                     CONFIG: 'include ::tripleo::profile::base::pacemaker;include ::tripleo::profile::pacemaker::cinder::backup_bundle'
133             image: *cinder_backup_image
134             volumes:
135               - /etc/hosts:/etc/hosts:ro
136               - /etc/localtime:/etc/localtime:ro
137               - /etc/puppet:/tmp/puppet-etc:ro
138               - /usr/share/openstack-puppet/modules:/usr/share/openstack-puppet/modules:ro
139               - /etc/corosync/corosync.conf:/etc/corosync/corosync.conf:ro
140               - /dev/shm:/dev/shm:rw
141       host_prep_tasks:
142         - name: create persistent directories
143           file:
144             path: "{{ item }}"
145             state: directory
146           with_items:
147             - /var/lib/cinder
148             - /var/log/containers/cinder
149       upgrade_tasks:
150         - name: Stop and disable cinder_backup service
151           tags: step2
152           service: name=openstack-cinder-backup state=stopped enabled=no