Merge "Set shared secrets, keys and passwords as hidden"
[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     type: string
26     default: ''
27   EnablePackageInstall:
28     default: 'false'
29     description: Set to true to enable package installation via Puppet
30     type: boolean
31   ServiceNetMap:
32     default: {}
33     description: Mapping of service_name -> network name. Typically set
34                  via parameter_defaults in the resource registry.
35     type: json
36   UpdateIdentifier:
37     default: ''
38     type: string
39     description: >
40       Setting to a previously unused value during stack-update will trigger
41       package update on all nodes
42   Hostname:
43     type: string
44     default: '' # Defaults to Heat created hostname
45   ExtraConfig:
46     default: {}
47     description: |
48       Additional hiera configuration to inject into the cluster. Note
49       that CephStorageExtraConfig takes precedence over ExtraConfig.
50     type: json
51   CephStorageExtraConfig:
52     default: {}
53     description: |
54       Role specific additional hiera configuration to inject into the cluster.
55     type: json
56
57
58 resources:
59   CephStorage:
60     type: OS::Nova::Server
61     properties:
62       image: {get_param: Image}
63       image_update_policy: {get_param: ImageUpdatePolicy}
64       flavor: {get_param: Flavor}
65       key_name: {get_param: KeyName}
66       networks:
67         - network: ctlplane
68       user_data_format: SOFTWARE_CONFIG
69       user_data: {get_resource: UserData}
70       name: {get_param: Hostname}
71
72   # Combine the NodeAdminUserData and NodeUserData mime archives
73   UserData:
74     type: OS::Heat::MultipartMime
75     properties:
76       parts:
77       - config: {get_resource: NodeAdminUserData}
78         type: multipart
79       - config: {get_resource: NodeUserData}
80         type: multipart
81
82   # Creates the "heat-admin" user if configured via the environment
83   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
84   NodeAdminUserData:
85     type: OS::TripleO::NodeAdminUserData
86
87   # For optional operator additional userdata
88   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
89   NodeUserData:
90     type: OS::TripleO::NodeUserData
91
92   StoragePort:
93     type: OS::TripleO::CephStorage::Ports::StoragePort
94     properties:
95       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
96
97   StorageMgmtPort:
98     type: OS::TripleO::CephStorage::Ports::StorageMgmtPort
99     properties:
100       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
101
102   NetworkConfig:
103     type: OS::TripleO::CephStorage::Net::SoftwareConfig
104     properties:
105       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
106       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
107       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
108
109   NetIpMap:
110     type: OS::TripleO::Network::Ports::NetIpMap
111     properties:
112       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
113       StorageIp: {get_attr: [StoragePort, ip_address]}
114       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
115
116   NetIpSubnetMap:
117     type: OS::TripleO::Network::Ports::NetIpSubnetMap
118     properties:
119       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
120       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
121       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
122
123   NetworkDeployment:
124     type: OS::TripleO::SoftwareDeployment
125     properties:
126       config: {get_resource: NetworkConfig}
127       server: {get_resource: CephStorage}
128
129   CephStorageDeployment:
130     type: OS::Heat::StructuredDeployment
131     depends_on: NetworkDeployment
132     properties:
133       config: {get_resource: CephStorageConfig}
134       server: {get_resource: CephStorage}
135       input_values:
136         ntp_servers:
137           str_replace:
138             template: '["server"]'
139             params:
140               server: {get_param: NtpServer}
141         enable_package_install: {get_param: EnablePackageInstall}
142         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
143         ceph_cluster_network: {get_attr: [NetIpSubnetMap, net_ip_subnet_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}
144         ceph_public_network: {get_attr: [NetIpSubnetMap, net_ip_subnet_map, {get_param: [ServiceNetMap, CephPublicNetwork]}]}
145
146   CephStorageConfig:
147     type: OS::Heat::StructuredConfig
148     properties:
149       group: os-apply-config
150       config:
151         hiera:
152           hierarchy:
153             - '"%{::uuid}"'
154             - heat_config_%{::deploy_config_name}
155             - ceph_extraconfig
156             - extraconfig
157             - ceph_cluster # provided by CephClusterConfig
158             - ceph
159             - '"%{::osfamily}"'
160             - common
161           datafiles:
162             common:
163               raw_data: {get_file: hieradata/common.yaml}
164             ceph_extraconfig:
165               mapped_data: {get_param: CephStorageExtraConfig}
166             extraconfig:
167               mapped_data: {get_param: ExtraConfig}
168             ceph:
169               raw_data: {get_file: hieradata/ceph.yaml}
170               mapped_data:
171                 ntp::servers: {get_input: ntp_servers}
172                 tripleo::packages::enable_install: {get_input: enable_package_install}
173                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
174                 ceph::profile::params::cluster_network: {get_input: ceph_cluster_network}
175                 ceph::profile::params::public_network: {get_input: ceph_public_network}
176
177   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
178   CephStorageExtraConfigPre:
179     depends_on: CephStorageDeployment
180     type: OS::TripleO::CephStorageExtraConfigPre
181     properties:
182         server: {get_resource: CephStorage}
183
184   # Hook for site-specific additional pre-deployment config,
185   # applying to all nodes, e.g node registration/unregistration
186   NodeExtraConfig:
187     depends_on: CephStorageExtraConfigPre
188     type: OS::TripleO::NodeExtraConfig
189     properties:
190         server: {get_resource: CephStorage}
191
192   UpdateConfig:
193     type: OS::TripleO::Tasks::PackageUpdate
194
195   UpdateDeployment:
196     type: OS::Heat::SoftwareDeployment
197     properties:
198       config: {get_resource: UpdateConfig}
199       server: {get_resource: CephStorage}
200       input_values:
201         update_identifier:
202           get_param: UpdateIdentifier
203
204 outputs:
205   hosts_entry:
206     value:
207       str_replace:
208         template: "IP HOST.localdomain HOST"
209         params:
210           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, CephStorageHostnameResolveNetwork]}]}
211           HOST: {get_attr: [CephStorage, name]}
212   nova_server_resource:
213     description: Heat resource handle for the ceph storage server
214     value:
215       {get_resource: CephStorage}
216   storage_ip_address:
217     description: IP address of the server in the storage network
218     value: {get_attr: [StoragePort, ip_address]}
219   storage_mgmt_ip_address:
220     description: IP address of the server in the storage_mgmt network
221     value: {get_attr: [StorageMgmtPort, ip_address]}
222   config_identifier:
223     description: identifier which changes if the node configuration may need re-applying
224     value:
225       list_join:
226       - ','
227       - - {get_attr: [CephStorageDeployment, deploy_stdout]}
228         - {get_attr: [CephStorageExtraConfigPre, deploy_stdout]}
229         - {get_param: UpdateIdentifier}