4b4c76fc8dd4ff0bd974c2ece67239e74ac0f5cd
[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         ceph_cluster_network: {get_attr: [NetIpSubnetMap, net_ip_subnet_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}
143         ceph_public_network: {get_attr: [NetIpSubnetMap, net_ip_subnet_map, {get_param: [ServiceNetMap, CephPublicNetwork]}]}
144
145   CephStorageConfig:
146     type: OS::Heat::StructuredConfig
147     properties:
148       group: os-apply-config
149       config:
150         hiera:
151           hierarchy:
152             - heat_config_%{::deploy_config_name}
153             - ceph_extraconfig
154             - extraconfig
155             - ceph_cluster # provided by CephClusterConfig
156             - ceph
157             - '"%{::osfamily}"'
158             - common
159           datafiles:
160             common:
161               raw_data: {get_file: hieradata/common.yaml}
162             ceph_extraconfig:
163               mapped_data: {get_param: CephStorageExtraConfig}
164             extraconfig:
165               mapped_data: {get_param: ExtraConfig}
166             ceph:
167               raw_data: {get_file: hieradata/ceph.yaml}
168               mapped_data:
169                 ntp::servers: {get_input: ntp_servers}
170                 tripleo::packages::enable_install: {get_input: enable_package_install}
171                 ceph::profile::params::cluster_network: {get_input: ceph_cluster_network}
172                 ceph::profile::params::public_network: {get_input: ceph_public_network}
173
174   UpdateConfig:
175     type: OS::TripleO::Tasks::PackageUpdate
176
177   UpdateDeployment:
178     type: OS::Heat::SoftwareDeployment
179     properties:
180       config: {get_resource: UpdateConfig}
181       server: {get_resource: CephStorage}
182       input_values:
183         update_identifier:
184           get_param: UpdateIdentifier
185
186 outputs:
187   hosts_entry:
188     value:
189       str_replace:
190         template: "IP HOST.localdomain HOST"
191         params:
192           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, CephStorageHostnameResolveNetwork]}]}
193           HOST: {get_attr: [CephStorage, name]}
194   nova_server_resource:
195     description: Heat resource handle for the ceph storage server
196     value:
197       {get_resource: CephStorage}
198   storage_ip_address:
199     description: IP address of the server in the storage network
200     value: {get_attr: [StoragePort, ip_address]}
201   storage_mgmt_ip_address:
202     description: IP address of the server in the storage_mgmt network
203     value: {get_attr: [StorageMgmtPort, ip_address]}
204   config_identifier:
205     description: identifier which changes if the node configuration may need re-applying
206     value: {get_attr: [CephStorageDeployment, deploy_stdout]}