2f2af2d6dc34b2abdd1fb206311a9ad95830852e
[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   CephClusterFSID:
62     type: string
63     description: The Ceph cluster FSID. Must be a UUID.
64   CephPoolDefaultPgNum:
65     description: default pg_num to use for the RBD pools
66     type: number
67     default: 32
68   CephPools:
69     description: >
70       It can be used to override settings for one of the predefined pools, or to create
71       additional ones. Example:
72       {
73         "volumes": {
74           "size": 5,
75           "pg_num": 128,
76           "pgp_num": 128
77          }
78       }
79     default: {}
80     type: json
81   CinderRbdPoolName:
82     default: volumes
83     type: string
84   CinderBackupRbdPoolName:
85     default: backups
86     type: string
87   GlanceRbdPoolName:
88     default: images
89     type: string
90   GnocchiRbdPoolName:
91     default: metrics
92     type: string
93   NovaRbdPoolName:
94     default: vms
95     type: string
96   CephClientKey:
97     description: The Ceph client key. Can be created with ceph-authtool --gen-print-key.
98     type: string
99     hidden: true
100   CephClientUserName:
101     default: openstack
102     type: string
103   CephPoolDefaultSize:
104     description: default minimum replication for RBD copies
105     type: number
106     default: 3
107   ManilaCephFSNativeCephFSAuthId:
108     default: manila
109     type: string
110   CephManilaClientKey:
111     default: ''
112     description: The Ceph client key. Can be created with ceph-authtool --gen-print-key.
113     type: string
114     hidden: true
115   CephIPv6:
116     default: False
117     type: boolean
118   DockerCephDaemonImage:
119     description: image
120     type: string
121     default: 'ceph/daemon:tag-build-master-jewel-centos-7'
122
123 conditions:
124   custom_registry_host:
125     yaql:
126       data: {get_param: DockerCephDaemonImage}
127       expression: $.data.split('/')[0].matches('(\.|:)')
128   perform_upgrade:
129     equals: [{get_param: StackUpdateType}, 'UPGRADE']
130
131 resources:
132   DockerImageUrlParts:
133     type: OS::Heat::Value
134     properties:
135       type: json
136       value:
137         host:
138           if:
139           - custom_registry_host
140           - yaql:
141               expression: let(location => $.data.rightSplit(':', 1)[0]) -> regex('(?:https?://)?(.*?)/(.*)').split($location)[1]
142               data: {get_param: DockerCephDaemonImage}
143           - docker.io
144         image:
145           if:
146           - custom_registry_host
147           - yaql:
148               expression: let(location => $.data.rightSplit(':', 1)[0]) -> regex('(?:https?://)?(.*?)/(.*)').split($location)[2]
149               data: {get_param: DockerCephDaemonImage}
150           - yaql:
151               expression: $.data.rightSplit(':', 1)[0]
152               data: {get_param: DockerCephDaemonImage}
153         image_tag:
154           yaql:
155             expression: $.data.rightSplit(':', 1)[1]
156             data: {get_param: DockerCephDaemonImage}
157
158 outputs:
159   role_data:
160     description: Role data for the Ceph base service.
161     value:
162       service_name: ceph_base
163       upgrade_tasks: []
164       step_config: ''
165       puppet_config:
166         config_image: ''
167         config_volume: ''
168         step_config: ''
169       docker_config: {}
170       service_workflow_tasks:
171         step2:
172           - name: ceph_base_ansible_workflow
173             workflow: { get_param: CephAnsibleWorkflowName }
174             input:
175               ansible_skip_tags: {get_param: CephAnsibleSkipTags}
176               ceph_ansible_extra_vars: {get_param: CephAnsibleExtraConfig}
177               ceph_ansible_playbook:
178                 if:
179                   - perform_upgrade
180                   - {get_param: CephAnsibleUpgradePlaybook}
181                   - {get_param: CephAnsiblePlaybook}
182       config_settings:
183         ceph_common_ansible_vars:
184           ireallymeanit: 'yes'
185           fsid: { get_param: CephClusterFSID }
186           docker: true
187           ceph_release: jewel
188           ceph_docker_registry: {get_attr: [DockerImageUrlParts, value, host]}
189           ceph_docker_image: {get_attr: [DockerImageUrlParts, value, image]}
190           ceph_docker_image_tag: {get_attr: [DockerImageUrlParts, value, image_tag]}
191           containerized_deployment: true
192           public_network: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephMonNetwork]}]}
193           monitor_address_block: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephMonNetwork]}]}
194           cluster_network: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}
195           user_config: true
196           ceph_stable: true
197           ceph_origin: distro
198           openstack_config: true
199           openstack_pools:
200             list_concat:
201               - repeat:
202                   template:
203                     name: <%pool%>
204                     pg_num: {get_param: CephPoolDefaultPgNum}
205                     rule_name: ""
206                   for_each:
207                     <%pool%>:
208                       - {get_param: CinderRbdPoolName}
209                       - {get_param: CinderBackupRbdPoolName}
210                       - {get_param: NovaRbdPoolName}
211                       - {get_param: GlanceRbdPoolName}
212                       - {get_param: GnocchiRbdPoolName}
213               - repeat:
214                   template:
215                     name: <%pool%>
216                     pg_num: {get_param: CephPoolDefaultPgNum}
217                     rule_name: ""
218                   for_each:
219                     <%pool%>: {get_param: CephPools}
220           openstack_keys: &openstack_keys
221           - name:
222               list_join:
223               - '.'
224               - - client
225                 - {get_param: CephClientUserName}
226             key: {get_param: CephClientKey}
227             mon_cap: "allow r"
228             osd_cap:
229               str_replace:
230                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"
231                params:
232                  NOVA_POOL: {get_param: NovaRbdPoolName}
233                  CINDER_POOL: {get_param: CinderRbdPoolName}
234                  CINDERBACKUP_POOL: {get_param: CinderBackupRbdPoolName}
235                  GLANCE_POOL: {get_param: GlanceRbdPoolName}
236                  GNOCCHI_POOL: {get_param: GnocchiRbdPoolName}
237             mode: "0644"
238           - name:
239               list_join:
240               - '.'
241               - - client
242                 - {get_param: ManilaCephFSNativeCephFSAuthId}
243             key: {get_param: CephManilaClientKey}
244             mon_cap: 'allow r, allow command \\\"auth del\\\", allow command \\\"auth caps\\\", allow command \\\"auth get\\\", allow command \\\"auth get-or-create\\\"'
245             mds_cap: "allow *"
246             osd_cap: "allow rw"
247             mode: "0644"
248           keys: *openstack_keys
249           pools: []
250           ceph_conf_overrides:
251             global:
252               osd_pool_default_size: {get_param: CephPoolDefaultSize}
253               osd_pool_default_pg_num: {get_param: CephPoolDefaultPgNum}
254           ntp_service_enabled: false
255           generate_fsid: false
256           ip_version:
257             if:
258             - {get_param: CephIPv6}
259             - ipv6
260             - ipv4