52c4a65c7ce8f49a0b7820e06f30db6a9e84cd04
[apex-tripleo-heat-templates.git] / docker / services / ceph-ansible / ceph-base.yaml
1 heat_template_version: pike
2
3 description: >
4   Ceph base service. Shared by all Ceph services.
5
6 parameters:
7   ServiceData:
8     default: {}
9     description: Dictionary packing service data
10     type: json
11   ServiceNetMap:
12     default: {}
13     description: Mapping of service_name -> network name. Typically set
14                  via parameter_defaults in the resource registry.  This
15                  mapping overrides those in ServiceNetMapDefaults.
16     type: json
17   DefaultPasswords:
18     default: {}
19     type: json
20   RoleName:
21     default: ''
22     description: Role name on which the service is applied
23     type: string
24   RoleParameters:
25     default: {}
26     description: Parameters specific to the role
27     type: json
28   EndpointMap:
29     default: {}
30     description: Mapping of service endpoint -> protocol. Typically set
31                  via parameter_defaults in the resource registry.
32     type: json
33   CephAnsibleWorkflowName:
34     type: string
35     description: Name of the Mistral workflow to execute
36     default: tripleo.storage.v1.ceph-install
37   CephAnsiblePlaybook:
38     type: string
39     description: Path to the ceph-ansible playbook to execute
40     default: /usr/share/ceph-ansible/site-docker.yml.sample
41   CephAnsibleExtraConfig:
42     type: json
43     description: Extra vars for the ceph-ansible playbook
44     default: {}
45   CephClusterFSID:
46     type: string
47     description: The Ceph cluster FSID. Must be a UUID.
48   CephPoolDefaultPgNum:
49     description: default pg_num to use for the RBD pools
50     type: number
51     default: 32
52   CephPools:
53     description: >
54       It can be used to override settings for one of the predefined pools, or to create
55       additional ones. Example:
56       {
57         "volumes": {
58           "size": 5,
59           "pg_num": 128,
60           "pgp_num": 128
61          }
62       }
63     default: {}
64     type: json
65   CinderRbdPoolName:
66     default: volumes
67     type: string
68   CinderBackupRbdPoolName:
69     default: backups
70     type: string
71   GlanceRbdPoolName:
72     default: images
73     type: string
74   GnocchiRbdPoolName:
75     default: metrics
76     type: string
77   NovaRbdPoolName:
78     default: vms
79     type: string
80   CephClientKey:
81     description: The Ceph client key. Can be created with ceph-authtool --gen-print-key. Currently only used for external Ceph deployments to create the openstack user keyring.
82     type: string
83     hidden: true
84   CephClientUserName:
85     default: openstack
86     type: string
87   CephPoolDefaultSize:
88     description: default minimum replication for RBD copies
89     type: number
90     default: 3
91   CephIPv6:
92     default: False
93     type: boolean
94   DockerCephDaemonImage:
95     description: image
96     type: string
97     default: 'ceph/daemon:tag-build-master-jewel-centos-7'
98
99 conditions:
100   custom_registry_host:
101     yaql:
102       data: {get_param: DockerCephDaemonImage}
103       expression: $.data.split('/')[0].matches('(\.|:)')
104
105 resources:
106   DockerImageUrlParts:
107     type: OS::Heat::Value
108     properties:
109       type: json
110       value:
111         host:
112           if:
113           - custom_registry_host
114           - yaql:
115               expression: let(location => $.data.rightSplit(':', 1)[0]) -> regex('(?:https?://)?(.*)/').split($location)[1]
116               data: {get_param: DockerCephDaemonImage}
117           - docker.io
118         image:
119           if:
120           - custom_registry_host
121           - yaql:
122               expression: let(location => $.data.rightSplit(':', 1)[0]) -> regex('(?:https?://)?(.*)/').split($location)[2]
123               data: {get_param: DockerCephDaemonImage}
124           - yaql:
125               expression: $.data.rightSplit(':', 1)[0]
126               data: {get_param: DockerCephDaemonImage}
127         image_tag:
128           yaql:
129             expression: $.data.rightSplit(':', 1)[1]
130             data: {get_param: DockerCephDaemonImage}
131
132 outputs:
133   role_data:
134     description: Role data for the Ceph base service.
135     value:
136       service_name: ceph_base
137       upgrade_tasks: []
138       step_config: ''
139       puppet_config:
140         config_image: ''
141         config_volume: ''
142         step_config: ''
143       docker_config: {}
144       service_workflow_tasks:
145         step2:
146           - name: ceph_base_ansible_workflow
147             workflow: { get_param: CephAnsibleWorkflowName }
148             input:
149               ceph_ansible_extra_vars: {get_param: CephAnsibleExtraConfig}
150               ceph_ansible_playbook: {get_param: CephAnsiblePlaybook}
151       config_settings:
152         ceph_common_ansible_vars:
153           fsid: { get_param: CephClusterFSID }
154           docker: true
155           ceph_docker_registry: {get_attr: [DockerImageUrlParts, value, host]}
156           ceph_docker_image: {get_attr: [DockerImageUrlParts, value, image]}
157           ceph_docker_image_tag: {get_attr: [DockerImageUrlParts, value, image_tag]}
158           containerized_deployment: true
159           public_network: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephMonNetwork]}]}
160           monitor_address_block: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephMonNetwork]}]}
161           cluster_network: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}
162           user_config: true
163           ceph_stable: true
164           ceph_origin: distro
165           openstack_config: true
166           openstack_pools:
167             list_concat:
168               - repeat:
169                   template:
170                     name: <%pool%>
171                     pg_num: {get_param: CephPoolDefaultPgNum}
172                     rule_name: ""
173                   for_each:
174                     <%pool%>:
175                       - {get_param: CinderRbdPoolName}
176                       - {get_param: CinderBackupRbdPoolName}
177                       - {get_param: NovaRbdPoolName}
178                       - {get_param: GlanceRbdPoolName}
179                       - {get_param: GnocchiRbdPoolName}
180               - repeat:
181                   template:
182                     name: <%pool%>
183                     pg_num: {get_param: CephPoolDefaultPgNum}
184                     rule_name: ""
185                   for_each:
186                     <%pool%>: {get_param: CephPools}
187           openstack_keys: &openstack_keys
188           - name:
189               list_join:
190               - '.'
191               - - client
192                 - {get_param: CephClientUserName}
193             key: {get_param: CephClientKey}
194             mon_cap: "allow r"
195             osd_cap:
196               str_replace:
197                template: "allow class-read object_prefix rbd_children, allow rwx pool=CINDER_POOL, allow rwx pool=CINDERBACKUP_POOL, allow rwx pool=NOVA_POOL, allow rwx pool=GLANCE_POOL, allow rwx pool=GNOCCHI_POOL"
198                params:
199                  NOVA_POOL: {get_param: NovaRbdPoolName}
200                  CINDER_POOL: {get_param: CinderRbdPoolName}
201                  CINDERBACKUP_POOL: {get_param: CinderBackupRbdPoolName}
202                  GLANCE_POOL: {get_param: GlanceRbdPoolName}
203                  GNOCCHI_POOL: {get_param: GnocchiRbdPoolName}
204             mode: "0644"
205           keys: *openstack_keys
206           pools: []
207           ceph_conf_overrides:
208             global:
209               osd_pool_default_size: {get_param: CephPoolDefaultSize}
210               osd_pool_default_pg_num: {get_param: CephPoolDefaultPgNum}
211           ntp_service_enabled: false
212           generate_fsid: false
213           ip_version:
214             if:
215             - {get_param: CephIPv6}
216             - ipv6
217             - ipv4