Merge "Add os-collect-config data as an output"
[apex-tripleo-heat-templates.git] / docker / services / 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   EndpointMap:
21     default: {}
22     description: Mapping of service endpoint -> protocol. Typically set
23                  via parameter_defaults in the resource registry.
24     type: json
25   ServiceNetMap:
26     default: {}
27     description: Mapping of service_name -> network name. Typically set
28                  via parameter_defaults in the resource registry.  This
29                  mapping overrides those in ServiceNetMapDefaults.
30     type: json
31   DefaultPasswords:
32     default: {}
33     type: json
34   RoleName:
35     default: ''
36     description: Role name on which the service is applied
37     type: string
38   RoleParameters:
39     default: {}
40     description: Parameters specific to the role
41     type: json
42
43
44 resources:
45
46   ContainersCommon:
47     type: ./containers-common.yaml
48
49   CinderBase:
50     type: ../../puppet/services/cinder-backup.yaml
51     properties:
52       EndpointMap: {get_param: EndpointMap}
53       ServiceNetMap: {get_param: ServiceNetMap}
54       DefaultPasswords: {get_param: DefaultPasswords}
55       RoleName: {get_param: RoleName}
56       RoleParameters: {get_param: RoleParameters}
57
58 outputs:
59   role_data:
60     description: Role data for the Cinder Backup role.
61     value:
62       service_name: {get_attr: [CinderBase, role_data, service_name]}
63       config_settings: {get_attr: [CinderBase, role_data, config_settings]}
64       step_config: &step_config
65         get_attr: [CinderBase, role_data, step_config]
66       service_config_settings: {get_attr: [CinderBase, role_data, service_config_settings]}
67       # BEGIN DOCKER SETTINGS
68       puppet_config:
69         config_volume: cinder
70         puppet_tags: cinder_config,file,concat,file_line
71         step_config: *step_config
72         config_image:
73           list_join:
74             - '/'
75             - [ {get_param: DockerNamespace}, {get_param: DockerCinderConfigImage} ]
76       kolla_config:
77         /var/lib/kolla/config_files/cinder_backup.json:
78           command: /usr/bin/cinder-backup --config-file /usr/share/cinder/cinder-dist.conf --config-file /etc/cinder/cinder.conf
79           permissions:
80             - path: /var/lib/cinder
81               owner: cinder:cinder
82               recurse: true
83             - path: /var/log/cinder
84               owner: cinder:cinder
85               recurse: true
86       docker_config:
87         step_3:
88           cinder_backup_init_logs:
89             start_order: 0
90             image: &cinder_backup_image
91               list_join:
92                 - '/'
93                 - [ {get_param: DockerNamespace}, {get_param: DockerCinderBackupImage} ]
94             privileged: false
95             user: root
96             volumes:
97               - /var/log/containers/cinder:/var/log/cinder
98             command: ['/bin/bash', '-c', 'chown -R cinder:cinder /var/log/cinder']
99         step_4:
100           cinder_backup:
101             image: *cinder_backup_image
102             net: host
103             privileged: false
104             restart: always
105             volumes:
106               list_concat:
107                 - {get_attr: [ContainersCommon, volumes]}
108                 -
109                   - /var/lib/kolla/config_files/cinder_backup.json:/var/lib/kolla/config_files/config.json:ro
110                   - /var/lib/config-data/cinder/etc/cinder/:/etc/cinder/:ro
111                   - /var/lib/config-data/ceph/etc/ceph/:/etc/ceph/:ro #FIXME: we need to generate a ceph.conf with puppet for this
112                   - /dev/:/dev/
113                   - /run/:/run/
114                   - /sys:/sys
115                   - /lib/modules:/lib/modules:ro
116                   - /etc/iscsi:/etc/iscsi
117                   - /var/lib/cinder:/var/lib/cinder
118                   - /var/log/containers/cinder:/var/log/cinder
119             environment:
120               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
121       host_prep_tasks:
122         - name: create persistent directories
123           file:
124             path: "{{ item }}"
125             state: directory
126           with_items:
127             - /var/lib/cinder
128             - /var/log/containers/cinder
129       upgrade_tasks:
130         - name: Stop and disable cinder_backup service
131           tags: step2
132           service: name=openstack-cinder-backup state=stopped enabled=no