Merge "Add output for host entries"
[apex-tripleo-heat-templates.git] / puppet / ceph-storage.yaml
1 heat_template_version: 2015-04-30
2 description: 'OpenStack ceph storage node configured by Puppet'
3 parameters:
4   Flavor:
5     description: Flavor for the Ceph Storage node.
6     type: string
7     constraints:
8       - custom_constraint: nova.flavor
9   Image:
10     type: string
11     default: overcloud-ceph-storage
12     constraints:
13       - custom_constraint: glance.image
14   ImageUpdatePolicy:
15     default: 'REBUILD_PRESERVE_EPHEMERAL'
16     description: What policy to use when reconstructing instances. REBUILD for rebuilds, REBUILD_PRESERVE_EPHEMERAL to preserve /mnt.
17     type: string
18   KeyName:
19     description: Name of an existing EC2 KeyPair to enable SSH access to the instances
20     type: string
21     default: default
22     constraints:
23       - custom_constraint: nova.keypair
24   NtpServer:
25     default: ''
26     description: Comma-separated list of ntp servers
27     type: comma_delimited_list
28   EnablePackageInstall:
29     default: 'false'
30     description: Set to true to enable package installation via Puppet
31     type: boolean
32   ServiceNetMap:
33     default: {}
34     description: Mapping of service_name -> network name. Typically set
35                  via parameter_defaults in the resource registry.
36     type: json
37   UpdateIdentifier:
38     default: ''
39     type: string
40     description: >
41       Setting to a previously unused value during stack-update will trigger
42       package update on all nodes
43   Hostname:
44     type: string
45     default: '' # Defaults to Heat created hostname
46   ExtraConfig:
47     default: {}
48     description: |
49       Additional hiera configuration to inject into the cluster. Note
50       that CephStorageExtraConfig takes precedence over ExtraConfig.
51     type: json
52   CephStorageExtraConfig:
53     default: {}
54     description: |
55       Role specific additional hiera configuration to inject into the cluster.
56     type: json
57   NetworkDeploymentActions:
58     type: comma_delimited_list
59     description: >
60       Heat action when to apply network configuration changes
61     default: ['CREATE']
62   CloudDomain:
63     default: ''
64     type: string
65     description: >
66       The DNS domain used for the hosts. This should match the dhcp_domain
67       configured in the Undercloud neutron. Defaults to localdomain.
68   ServerMetadata:
69     default: {}
70     description: >
71       Extra properties or metadata passed to Nova for the created nodes in
72       the overcloud. It's accessible via the Nova metadata API.
73     type: json
74   SchedulerHints:
75     type: json
76     description: Optional scheduler hints to pass to nova
77     default: {}
78
79 resources:
80   CephStorage:
81     type: OS::Nova::Server
82     properties:
83       image: {get_param: Image}
84       image_update_policy: {get_param: ImageUpdatePolicy}
85       flavor: {get_param: Flavor}
86       key_name: {get_param: KeyName}
87       networks:
88         - network: ctlplane
89       user_data_format: SOFTWARE_CONFIG
90       user_data: {get_resource: UserData}
91       name: {get_param: Hostname}
92       metadata: {get_param: ServerMetadata}
93       scheduler_hints: {get_param: SchedulerHints}
94
95   # Combine the NodeAdminUserData and NodeUserData mime archives
96   UserData:
97     type: OS::Heat::MultipartMime
98     properties:
99       parts:
100       - config: {get_resource: NodeAdminUserData}
101         type: multipart
102       - config: {get_resource: NodeUserData}
103         type: multipart
104
105   # Creates the "heat-admin" user if configured via the environment
106   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
107   NodeAdminUserData:
108     type: OS::TripleO::NodeAdminUserData
109
110   # For optional operator additional userdata
111   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
112   NodeUserData:
113     type: OS::TripleO::NodeUserData
114
115   StoragePort:
116     type: OS::TripleO::CephStorage::Ports::StoragePort
117     properties:
118       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
119
120   StorageMgmtPort:
121     type: OS::TripleO::CephStorage::Ports::StorageMgmtPort
122     properties:
123       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
124
125   NetworkConfig:
126     type: OS::TripleO::CephStorage::Net::SoftwareConfig
127     properties:
128       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
129       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
130       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
131
132   NetIpMap:
133     type: OS::TripleO::Network::Ports::NetIpMap
134     properties:
135       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
136       StorageIp: {get_attr: [StoragePort, ip_address]}
137       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
138
139   NetIpSubnetMap:
140     type: OS::TripleO::Network::Ports::NetIpSubnetMap
141     properties:
142       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
143       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
144       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
145
146   NetworkDeployment:
147     type: OS::TripleO::SoftwareDeployment
148     properties:
149       config: {get_resource: NetworkConfig}
150       server: {get_resource: CephStorage}
151       actions: {get_param: NetworkDeploymentActions}
152
153   CephStorageDeployment:
154     type: OS::Heat::StructuredDeployment
155     depends_on: NetworkDeployment
156     properties:
157       config: {get_resource: CephStorageConfig}
158       server: {get_resource: CephStorage}
159       input_values:
160         ntp_servers: {get_param: NtpServer}
161         enable_package_install: {get_param: EnablePackageInstall}
162         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
163         ceph_cluster_network: {get_attr: [NetIpSubnetMap, net_ip_subnet_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}
164         ceph_public_network: {get_attr: [NetIpSubnetMap, net_ip_subnet_map, {get_param: [ServiceNetMap, CephPublicNetwork]}]}
165
166   CephStorageConfig:
167     type: OS::Heat::StructuredConfig
168     properties:
169       group: os-apply-config
170       config:
171         hiera:
172           hierarchy:
173             - '"%{::uuid}"'
174             - heat_config_%{::deploy_config_name}
175             - ceph_extraconfig
176             - extraconfig
177             - ceph_cluster # provided by CephClusterConfig
178             - ceph
179             - '"%{::osfamily}"'
180             - common
181           datafiles:
182             common:
183               raw_data: {get_file: hieradata/common.yaml}
184             ceph_extraconfig:
185               mapped_data: {get_param: CephStorageExtraConfig}
186             extraconfig:
187               mapped_data: {get_param: ExtraConfig}
188             ceph:
189               raw_data: {get_file: hieradata/ceph.yaml}
190               mapped_data:
191                 ntp::servers: {get_input: ntp_servers}
192                 tripleo::packages::enable_install: {get_input: enable_package_install}
193                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
194                 ceph::profile::params::cluster_network: {get_input: ceph_cluster_network}
195                 ceph::profile::params::public_network: {get_input: ceph_public_network}
196
197   # Resource for site-specific injection of root certificate
198   NodeTLSCAData:
199     depends_on: CephStorageDeployment
200     type: OS::TripleO::NodeTLSCAData
201     properties:
202       server: {get_resource: CephStorage}
203
204   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
205   CephStorageExtraConfigPre:
206     depends_on: CephStorageDeployment
207     type: OS::TripleO::CephStorageExtraConfigPre
208     properties:
209         server: {get_resource: CephStorage}
210
211   # Hook for site-specific additional pre-deployment config,
212   # applying to all nodes, e.g node registration/unregistration
213   NodeExtraConfig:
214     depends_on: [CephStorageExtraConfigPre, NodeTLSCAData]
215     type: OS::TripleO::NodeExtraConfig
216     properties:
217         server: {get_resource: CephStorage}
218
219   UpdateConfig:
220     type: OS::TripleO::Tasks::PackageUpdate
221
222   UpdateDeployment:
223     type: OS::Heat::SoftwareDeployment
224     properties:
225       config: {get_resource: UpdateConfig}
226       server: {get_resource: CephStorage}
227       input_values:
228         update_identifier:
229           get_param: UpdateIdentifier
230
231 outputs:
232   hosts_entry:
233     value:
234       str_replace:
235         template: "IP HOST.DOMAIN HOST"
236         params:
237           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, CephStorageHostnameResolveNetwork]}]}
238           DOMAIN: {get_param: CloudDomain}
239           HOST: {get_attr: [CephStorage, name]}
240   nova_server_resource:
241     description: Heat resource handle for the ceph storage server
242     value:
243       {get_resource: CephStorage}
244   storage_ip_address:
245     description: IP address of the server in the storage network
246     value: {get_attr: [StoragePort, ip_address]}
247   storage_mgmt_ip_address:
248     description: IP address of the server in the storage_mgmt network
249     value: {get_attr: [StorageMgmtPort, ip_address]}
250   config_identifier:
251     description: identifier which changes if the node configuration may need re-applying
252     value:
253       list_join:
254       - ','
255       - - {get_attr: [CephStorageDeployment, deploy_stdout]}
256         - {get_attr: [NodeTLSCAData, deploy_stdout]}
257         - {get_attr: [CephStorageExtraConfigPre, deploy_stdout]}
258         - {get_param: UpdateIdentifier}