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