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