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