476230d923e1d4f45450351015b7d73f20ba5663
[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.
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   ManilaCephFSNativeCephFSAuthId:
92     default: manila
93     type: string
94   CephManilaClientKey:
95     default: ''
96     description: The Ceph client key. Can be created with ceph-authtool --gen-print-key.
97     type: string
98     hidden: true
99   CephIPv6:
100     default: False
101     type: boolean
102   DockerCephDaemonImage:
103     description: image
104     type: string
105     default: 'ceph/daemon:tag-build-master-jewel-centos-7'
106
107 conditions:
108   custom_registry_host:
109     yaql:
110       data: {get_param: DockerCephDaemonImage}
111       expression: $.data.split('/')[0].matches('(\.|:)')
112
113 resources:
114   DockerImageUrlParts:
115     type: OS::Heat::Value
116     properties:
117       type: json
118       value:
119         host:
120           if:
121           - custom_registry_host
122           - yaql:
123               expression: let(location => $.data.rightSplit(':', 1)[0]) -> regex('(?:https?://)?(.*)/').split($location)[1]
124               data: {get_param: DockerCephDaemonImage}
125           - docker.io
126         image:
127           if:
128           - custom_registry_host
129           - yaql:
130               expression: let(location => $.data.rightSplit(':', 1)[0]) -> regex('(?:https?://)?(.*)/').split($location)[2]
131               data: {get_param: DockerCephDaemonImage}
132           - yaql:
133               expression: $.data.rightSplit(':', 1)[0]
134               data: {get_param: DockerCephDaemonImage}
135         image_tag:
136           yaql:
137             expression: $.data.rightSplit(':', 1)[1]
138             data: {get_param: DockerCephDaemonImage}
139
140 outputs:
141   role_data:
142     description: Role data for the Ceph base service.
143     value:
144       service_name: ceph_base
145       upgrade_tasks: []
146       step_config: ''
147       puppet_config:
148         config_image: ''
149         config_volume: ''
150         step_config: ''
151       docker_config: {}
152       service_workflow_tasks:
153         step2:
154           - name: ceph_base_ansible_workflow
155             workflow: { get_param: CephAnsibleWorkflowName }
156             input:
157               ceph_ansible_extra_vars: {get_param: CephAnsibleExtraConfig}
158               ceph_ansible_playbook: {get_param: CephAnsiblePlaybook}
159       config_settings:
160         ceph_common_ansible_vars:
161           fsid: { get_param: CephClusterFSID }
162           docker: true
163           ceph_docker_registry: {get_attr: [DockerImageUrlParts, value, host]}
164           ceph_docker_image: {get_attr: [DockerImageUrlParts, value, image]}
165           ceph_docker_image_tag: {get_attr: [DockerImageUrlParts, value, image_tag]}
166           containerized_deployment: true
167           public_network: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephMonNetwork]}]}
168           monitor_address_block: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephMonNetwork]}]}
169           cluster_network: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}
170           user_config: true
171           ceph_stable: true
172           ceph_origin: distro
173           openstack_config: true
174           openstack_pools:
175             list_concat:
176               - repeat:
177                   template:
178                     name: <%pool%>
179                     pg_num: {get_param: CephPoolDefaultPgNum}
180                     rule_name: ""
181                   for_each:
182                     <%pool%>:
183                       - {get_param: CinderRbdPoolName}
184                       - {get_param: CinderBackupRbdPoolName}
185                       - {get_param: NovaRbdPoolName}
186                       - {get_param: GlanceRbdPoolName}
187                       - {get_param: GnocchiRbdPoolName}
188               - repeat:
189                   template:
190                     name: <%pool%>
191                     pg_num: {get_param: CephPoolDefaultPgNum}
192                     rule_name: ""
193                   for_each:
194                     <%pool%>: {get_param: CephPools}
195           openstack_keys: &openstack_keys
196           - name:
197               list_join:
198               - '.'
199               - - client
200                 - {get_param: CephClientUserName}
201             key: {get_param: CephClientKey}
202             mon_cap: "allow r"
203             osd_cap:
204               str_replace:
205                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"
206                params:
207                  NOVA_POOL: {get_param: NovaRbdPoolName}
208                  CINDER_POOL: {get_param: CinderRbdPoolName}
209                  CINDERBACKUP_POOL: {get_param: CinderBackupRbdPoolName}
210                  GLANCE_POOL: {get_param: GlanceRbdPoolName}
211                  GNOCCHI_POOL: {get_param: GnocchiRbdPoolName}
212             mode: "0644"
213           - name:
214               list_join:
215               - '.'
216               - - client
217                 - {get_param: ManilaCephFSNativeCephFSAuthId}
218             key: {get_param: CephManilaClientKey}
219             mon_cap: "allow r, allow command auth del, allow command auth caps, allow command auth get, allow command auth get-or-create"
220             mds_cap: "allow *"
221             osd_cap: "allow rw"
222             mode: "0644"
223           keys: *openstack_keys
224           pools: []
225           ceph_conf_overrides:
226             global:
227               osd_pool_default_size: {get_param: CephPoolDefaultSize}
228               osd_pool_default_pg_num: {get_param: CephPoolDefaultPgNum}
229           ntp_service_enabled: false
230           generate_fsid: false
231           ip_version:
232             if:
233             - {get_param: CephIPv6}
234             - ipv6
235             - ipv4