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