Merge "Update CephPools format in the docker templates to fit ceph-ansible" into...
[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   StackUpdateType:
34     type: string
35     description: >
36       Type of update, to differentiate between UPGRADE and UPDATE cases
37       when StackAction is UPDATE (both are the same stack action).
38     constraints:
39     - allowed_values: ['', 'UPGRADE']
40     default: ''
41   CephAnsibleWorkflowName:
42     type: string
43     description: Name of the Mistral workflow to execute
44     default: tripleo.storage.v1.ceph-install
45   CephAnsiblePlaybook:
46     type: string
47     description: Path to the ceph-ansible playbook to execute
48     default: /usr/share/ceph-ansible/site-docker.yml.sample
49   CephAnsibleUpgradePlaybook:
50     type: string
51     description: Path to the ceph-ansible playbook to execute on upgrade
52     default: /usr/share/ceph-ansible/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml
53   CephAnsibleExtraConfig:
54     type: json
55     description: Extra vars for the ceph-ansible playbook
56     default: {}
57   CephAnsibleSkipTags:
58     type: string
59     description: List of ceph-ansible tags to skip
60     default: 'package-install,with_pkg'
61   CephConfigOverrides:
62     type: json
63     description: Extra config settings to dump into ceph.conf
64     default: {}
65   CephClusterFSID:
66     type: string
67     description: The Ceph cluster FSID. Must be a UUID.
68   CephPoolDefaultPgNum:
69     description: default pg_num to use for the RBD pools
70     type: number
71     default: 128
72   CephPools:
73     description: >
74       It can be used to override settings for one of the predefined pools, or to create
75       additional ones. Example:
76       [{"name": "volumes", "pg_num": 64, "rule_name": ""}]
77     default: []
78     type: comma_delimited_list
79   CinderRbdPoolName:
80     default: volumes
81     type: string
82   CinderBackupRbdPoolName:
83     default: backups
84     type: string
85   GlanceRbdPoolName:
86     default: images
87     type: string
88   GnocchiRbdPoolName:
89     default: metrics
90     type: string
91   NovaRbdPoolName:
92     default: vms
93     type: string
94   CephClientKey:
95     description: The Ceph client key. Can be created with ceph-authtool --gen-print-key.
96     type: string
97     hidden: true
98   CephClientUserName:
99     default: openstack
100     type: string
101   CephRgwClientName:
102     default: radosgw
103     type: string
104   CephRgwKey:
105     description: The cephx key for the radosgw client. Can be created
106                  with ceph-authtool --gen-print-key.
107     type: string
108     hidden: true
109   CephPoolDefaultSize:
110     description: default minimum replication for RBD copies
111     type: number
112     default: 3
113   ManilaCephFSNativeCephFSAuthId:
114     default: manila
115     type: string
116   CephManilaClientKey:
117     default: ''
118     description: The Ceph client key. Can be created with ceph-authtool --gen-print-key.
119     type: string
120     hidden: true
121   CephIPv6:
122     default: False
123     type: boolean
124   SwiftPassword:
125     description: The password for the swift service account
126     type: string
127     hidden: true
128   DockerCephDaemonImage:
129     description: image
130     type: string
131
132 conditions:
133   custom_registry_host:
134     yaql:
135       data: {get_param: DockerCephDaemonImage}
136       expression: $.data.split('/')[0].matches('(\.|:)')
137   perform_upgrade:
138     equals: [{get_param: StackUpdateType}, 'UPGRADE']
139
140 resources:
141   DockerImageUrlParts:
142     type: OS::Heat::Value
143     properties:
144       type: json
145       value:
146         host:
147           if:
148           - custom_registry_host
149           - yaql:
150               expression: let(location => $.data.rightSplit(':', 1)[0]) -> regex('(?:https?://)?(.*?)/(.*)').split($location)[1]
151               data: {get_param: DockerCephDaemonImage}
152           - docker.io
153         image:
154           if:
155           - custom_registry_host
156           - yaql:
157               expression: let(location => $.data.rightSplit(':', 1)[0]) -> regex('(?:https?://)?(.*?)/(.*)').split($location)[2]
158               data: {get_param: DockerCephDaemonImage}
159           - yaql:
160               expression: $.data.rightSplit(':', 1)[0]
161               data: {get_param: DockerCephDaemonImage}
162         image_tag:
163           yaql:
164             expression: $.data.rightSplit(':', 1)[1]
165             data: {get_param: DockerCephDaemonImage}
166
167 outputs:
168   role_data:
169     description: Role data for the Ceph base service.
170     value:
171       service_name: ceph_base
172       upgrade_tasks: []
173       step_config: ''
174       puppet_config:
175         config_image: ''
176         config_volume: ''
177         step_config: ''
178       docker_config: {}
179       workflow_tasks:
180         step2:
181           - name: ceph_base_ansible_workflow
182             workflow: { get_param: CephAnsibleWorkflowName }
183             input:
184               ansible_skip_tags: {get_param: CephAnsibleSkipTags}
185               ceph_ansible_extra_vars: {get_param: CephAnsibleExtraConfig}
186               ceph_ansible_playbook:
187                 if:
188                   - perform_upgrade
189                   - {get_param: CephAnsibleUpgradePlaybook}
190                   - {get_param: CephAnsiblePlaybook}
191       config_settings:
192         ceph_common_ansible_vars:
193           ireallymeanit: 'yes'
194           fsid: { get_param: CephClusterFSID }
195           docker: true
196           ceph_release: jewel
197           ceph_docker_registry: {get_attr: [DockerImageUrlParts, value, host]}
198           ceph_docker_image: {get_attr: [DockerImageUrlParts, value, image]}
199           ceph_docker_image_tag: {get_attr: [DockerImageUrlParts, value, image_tag]}
200           containerized_deployment: true
201           public_network: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephMonNetwork]}]}
202           monitor_address_block: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephMonNetwork]}]}
203           cluster_network: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}
204           user_config: true
205           ceph_stable: true
206           ceph_origin: distro
207           openstack_config: true
208           openstack_pools:
209             list_concat:
210               - repeat:
211                   template:
212                     name: <%pool%>
213                     pg_num: {get_param: CephPoolDefaultPgNum}
214                     rule_name: ""
215                   for_each:
216                     <%pool%>:
217                       - {get_param: CinderRbdPoolName}
218                       - {get_param: CinderBackupRbdPoolName}
219                       - {get_param: NovaRbdPoolName}
220                       - {get_param: GlanceRbdPoolName}
221                       - {get_param: GnocchiRbdPoolName}
222               - {get_param: CephPools}
223           openstack_keys: &openstack_keys
224           - name:
225               list_join:
226               - '.'
227               - - client
228                 - {get_param: CephClientUserName}
229             key: {get_param: CephClientKey}
230             mon_cap: "allow r"
231             osd_cap:
232               str_replace:
233                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"
234                params:
235                  NOVA_POOL: {get_param: NovaRbdPoolName}
236                  CINDER_POOL: {get_param: CinderRbdPoolName}
237                  CINDERBACKUP_POOL: {get_param: CinderBackupRbdPoolName}
238                  GLANCE_POOL: {get_param: GlanceRbdPoolName}
239                  GNOCCHI_POOL: {get_param: GnocchiRbdPoolName}
240             mode: "0644"
241           - name:
242               list_join:
243               - '.'
244               - - client
245                 - {get_param: ManilaCephFSNativeCephFSAuthId}
246             key: {get_param: CephManilaClientKey}
247             mon_cap: 'allow r, allow command \\\"auth del\\\", allow command \\\"auth caps\\\", allow command \\\"auth get\\\", allow command \\\"auth get-or-create\\\"'
248             mds_cap: "allow *"
249             osd_cap: "allow rw"
250             mode: "0644"
251           - name:
252               list_join:
253               - '.'
254               - - client
255                 - {get_param: CephRgwClientName}
256             key: {get_param: CephRgwKey}
257             mon_cap: "allow rw"
258             osd_cap: "allow rwx"
259             mode: "0644"
260           keys: *openstack_keys
261           pools: []
262           ceph_conf_overrides:
263             global:
264               map_merge:
265                 - osd_pool_default_size: {get_param: CephPoolDefaultSize}
266                   osd_pool_default_pg_num: {get_param: CephPoolDefaultPgNum}
267                   osd_pool_default_pgp_num: {get_param: CephPoolDefaultPgNum}
268                   rgw_keystone_api_version: 3
269                   rgw_keystone_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
270                   rgw_keystone_accepted_roles: 'Member, _member_, admin'
271                   rgw_keystone_admin_domain: default
272                   rgw_keystone_admin_project: service
273                   rgw_keystone_admin_user: swift
274                   rgw_keystone_admin_password: {get_param: SwiftPassword}
275                   rgw_s3_auth_use_keystone: 'true'
276                 - {get_param: CephConfigOverrides}
277           ntp_service_enabled: false
278           generate_fsid: false
279           ip_version:
280             if:
281             - {get_param: CephIPv6}
282             - ipv6
283             - ipv4