Add SoftwareConfigTransport for switching transports
[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   SoftwareConfigTransport:
63     default: POLL_SERVER_CFN
64     description: |
65       How the server should receive the metadata required for software configuration.
66     type: string
67     constraints:
68     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
69   CloudDomain:
70     default: ''
71     type: string
72     description: >
73       The DNS domain used for the hosts. This should match the dhcp_domain
74       configured in the Undercloud neutron. Defaults to localdomain.
75   ServerMetadata:
76     default: {}
77     description: >
78       Extra properties or metadata passed to Nova for the created nodes in
79       the overcloud. It's accessible via the Nova metadata API.
80     type: json
81
82
83 resources:
84   CephStorage:
85     type: OS::Nova::Server
86     properties:
87       image: {get_param: Image}
88       image_update_policy: {get_param: ImageUpdatePolicy}
89       flavor: {get_param: Flavor}
90       key_name: {get_param: KeyName}
91       networks:
92         - network: ctlplane
93       user_data_format: SOFTWARE_CONFIG
94       user_data: {get_resource: UserData}
95       name: {get_param: Hostname}
96       software_config_transport: {get_param: SoftwareConfigTransport}
97       metadata: {get_param: ServerMetadata}
98
99   # Combine the NodeAdminUserData and NodeUserData mime archives
100   UserData:
101     type: OS::Heat::MultipartMime
102     properties:
103       parts:
104       - config: {get_resource: NodeAdminUserData}
105         type: multipart
106       - config: {get_resource: NodeUserData}
107         type: multipart
108
109   # Creates the "heat-admin" user if configured via the environment
110   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
111   NodeAdminUserData:
112     type: OS::TripleO::NodeAdminUserData
113
114   # For optional operator additional userdata
115   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
116   NodeUserData:
117     type: OS::TripleO::NodeUserData
118
119   StoragePort:
120     type: OS::TripleO::CephStorage::Ports::StoragePort
121     properties:
122       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
123
124   StorageMgmtPort:
125     type: OS::TripleO::CephStorage::Ports::StorageMgmtPort
126     properties:
127       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
128
129   NetworkConfig:
130     type: OS::TripleO::CephStorage::Net::SoftwareConfig
131     properties:
132       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
133       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
134       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
135
136   NetIpMap:
137     type: OS::TripleO::Network::Ports::NetIpMap
138     properties:
139       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
140       StorageIp: {get_attr: [StoragePort, ip_address]}
141       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
142
143   NetIpSubnetMap:
144     type: OS::TripleO::Network::Ports::NetIpSubnetMap
145     properties:
146       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
147       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
148       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
149
150   NetworkDeployment:
151     type: OS::TripleO::SoftwareDeployment
152     properties:
153       config: {get_resource: NetworkConfig}
154       server: {get_resource: CephStorage}
155       actions: {get_param: NetworkDeploymentActions}
156
157   CephStorageDeployment:
158     type: OS::Heat::StructuredDeployment
159     depends_on: NetworkDeployment
160     properties:
161       config: {get_resource: CephStorageConfig}
162       server: {get_resource: CephStorage}
163       input_values:
164         ntp_servers: {get_param: NtpServer}
165         enable_package_install: {get_param: EnablePackageInstall}
166         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
167         ceph_cluster_network: {get_attr: [NetIpSubnetMap, net_ip_subnet_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}
168         ceph_public_network: {get_attr: [NetIpSubnetMap, net_ip_subnet_map, {get_param: [ServiceNetMap, CephPublicNetwork]}]}
169
170   CephStorageConfig:
171     type: OS::Heat::StructuredConfig
172     properties:
173       group: os-apply-config
174       config:
175         hiera:
176           hierarchy:
177             - '"%{::uuid}"'
178             - heat_config_%{::deploy_config_name}
179             - ceph_extraconfig
180             - extraconfig
181             - ceph_cluster # provided by CephClusterConfig
182             - ceph
183             - '"%{::osfamily}"'
184             - common
185           datafiles:
186             common:
187               raw_data: {get_file: hieradata/common.yaml}
188             ceph_extraconfig:
189               mapped_data: {get_param: CephStorageExtraConfig}
190             extraconfig:
191               mapped_data: {get_param: ExtraConfig}
192             ceph:
193               raw_data: {get_file: hieradata/ceph.yaml}
194               mapped_data:
195                 ntp::servers: {get_input: ntp_servers}
196                 tripleo::packages::enable_install: {get_input: enable_package_install}
197                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
198                 ceph::profile::params::cluster_network: {get_input: ceph_cluster_network}
199                 ceph::profile::params::public_network: {get_input: ceph_public_network}
200
201   # Resource for site-specific injection of root certificate
202   NodeTLSCAData:
203     depends_on: CephStorageDeployment
204     type: OS::TripleO::NodeTLSCAData
205     properties:
206       server: {get_resource: CephStorage}
207
208   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
209   CephStorageExtraConfigPre:
210     depends_on: CephStorageDeployment
211     type: OS::TripleO::CephStorageExtraConfigPre
212     properties:
213         server: {get_resource: CephStorage}
214
215   # Hook for site-specific additional pre-deployment config,
216   # applying to all nodes, e.g node registration/unregistration
217   NodeExtraConfig:
218     depends_on: [CephStorageExtraConfigPre, NodeTLSCAData]
219     type: OS::TripleO::NodeExtraConfig
220     properties:
221         server: {get_resource: CephStorage}
222
223   UpdateConfig:
224     type: OS::TripleO::Tasks::PackageUpdate
225
226   UpdateDeployment:
227     type: OS::Heat::SoftwareDeployment
228     properties:
229       config: {get_resource: UpdateConfig}
230       server: {get_resource: CephStorage}
231       input_values:
232         update_identifier:
233           get_param: UpdateIdentifier
234
235 outputs:
236   hosts_entry:
237     value:
238       str_replace:
239         template: "IP HOST.DOMAIN HOST"
240         params:
241           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, CephStorageHostnameResolveNetwork]}]}
242           DOMAIN: {get_param: CloudDomain}
243           HOST: {get_attr: [CephStorage, name]}
244   nova_server_resource:
245     description: Heat resource handle for the ceph storage server
246     value:
247       {get_resource: CephStorage}
248   storage_ip_address:
249     description: IP address of the server in the storage network
250     value: {get_attr: [StoragePort, ip_address]}
251   storage_mgmt_ip_address:
252     description: IP address of the server in the storage_mgmt network
253     value: {get_attr: [StorageMgmtPort, ip_address]}
254   config_identifier:
255     description: identifier which changes if the node configuration may need re-applying
256     value:
257       list_join:
258       - ','
259       - - {get_attr: [CephStorageDeployment, deploy_stdout]}
260         - {get_attr: [NodeTLSCAData, deploy_stdout]}
261         - {get_attr: [CephStorageExtraConfigPre, deploy_stdout]}
262         - {get_param: UpdateIdentifier}