Merge "Add params needed for the ceph-ansible switch to containers playbook"
[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   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           ireallymeanit: 'yes'
162           fsid: { get_param: CephClusterFSID }
163           docker: true
164           ceph_docker_registry: {get_attr: [DockerImageUrlParts, value, host]}
165           ceph_docker_image: {get_attr: [DockerImageUrlParts, value, image]}
166           ceph_docker_image_tag: {get_attr: [DockerImageUrlParts, value, image_tag]}
167           containerized_deployment: true
168           public_network: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephMonNetwork]}]}
169           monitor_address_block: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephMonNetwork]}]}
170           cluster_network: {get_param: [ServiceData, net_cidr_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}
171           user_config: true
172           ceph_stable: true
173           ceph_origin: distro
174           openstack_config: true
175           openstack_pools:
176             list_concat:
177               - repeat:
178                   template:
179                     name: <%pool%>
180                     pg_num: {get_param: CephPoolDefaultPgNum}
181                     rule_name: ""
182                   for_each:
183                     <%pool%>:
184                       - {get_param: CinderRbdPoolName}
185                       - {get_param: CinderBackupRbdPoolName}
186                       - {get_param: NovaRbdPoolName}
187                       - {get_param: GlanceRbdPoolName}
188                       - {get_param: GnocchiRbdPoolName}
189               - repeat:
190                   template:
191                     name: <%pool%>
192                     pg_num: {get_param: CephPoolDefaultPgNum}
193                     rule_name: ""
194                   for_each:
195                     <%pool%>: {get_param: CephPools}
196           openstack_keys: &openstack_keys
197           - name:
198               list_join:
199               - '.'
200               - - client
201                 - {get_param: CephClientUserName}
202             key: {get_param: CephClientKey}
203             mon_cap: "allow r"
204             osd_cap:
205               str_replace:
206                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"
207                params:
208                  NOVA_POOL: {get_param: NovaRbdPoolName}
209                  CINDER_POOL: {get_param: CinderRbdPoolName}
210                  CINDERBACKUP_POOL: {get_param: CinderBackupRbdPoolName}
211                  GLANCE_POOL: {get_param: GlanceRbdPoolName}
212                  GNOCCHI_POOL: {get_param: GnocchiRbdPoolName}
213             mode: "0644"
214           - name:
215               list_join:
216               - '.'
217               - - client
218                 - {get_param: ManilaCephFSNativeCephFSAuthId}
219             key: {get_param: CephManilaClientKey}
220             mon_cap: "allow r, allow command auth del, allow command auth caps, allow command auth get, allow command auth get-or-create"
221             mds_cap: "allow *"
222             osd_cap: "allow rw"
223             mode: "0644"
224           keys: *openstack_keys
225           pools: []
226           ceph_conf_overrides:
227             global:
228               osd_pool_default_size: {get_param: CephPoolDefaultSize}
229               osd_pool_default_pg_num: {get_param: CephPoolDefaultPgNum}
230           ntp_service_enabled: false
231           generate_fsid: false
232           ip_version:
233             if:
234             - {get_param: CephIPv6}
235             - ipv6
236             - ipv4