Merge "Ensure SELinux is permissive on Ceph OSDs"
[apex-tripleo-heat-templates.git] / puppet / ceph-storage-puppet.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: NodeUserData}
70       name: {get_param: Hostname}
71
72   NodeUserData:
73     type: OS::TripleO::NodeUserData
74
75   StoragePort:
76     type: OS::TripleO::CephStorage::Ports::StoragePort
77     properties:
78       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
79
80   StorageMgmtPort:
81     type: OS::TripleO::CephStorage::Ports::StorageMgmtPort
82     properties:
83       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
84
85   NetworkConfig:
86     type: OS::TripleO::CephStorage::Net::SoftwareConfig
87     properties:
88       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
89       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
90
91   NetIpMap:
92     type: OS::TripleO::Network::Ports::NetIpMap
93     properties:
94       StorageIp: {get_attr: [StoragePort, ip_address]}
95       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
96
97   NetIpSubnetMap:
98     type: OS::TripleO::Network::Ports::NetIpMap
99     properties:
100       StorageIp: {get_attr: [StoragePort, ip_subnet]}
101       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_subnet]}
102
103   NetworkDeployment:
104     type: OS::TripleO::SoftwareDeployment
105     properties:
106       config: {get_resource: NetworkConfig}
107       server: {get_resource: CephStorage}
108
109   CephStorageDeployment:
110     type: OS::Heat::StructuredDeployment
111     depends_on: NetworkDeployment
112     properties:
113       config: {get_resource: CephStorageConfig}
114       server: {get_resource: CephStorage}
115       input_values:
116         ntp_servers:
117           str_replace:
118             template: '["server"]'
119             params:
120               server: {get_param: NtpServer}
121         enable_package_install: {get_param: EnablePackageInstall}
122         ceph_cluster_network: {get_attr: [NetIpSubnetMap, net_ip_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}
123         ceph_public_network: {get_attr: [NetIpSubnetMap, net_ip_map, {get_param: [ServiceNetMap, CephPublicNetwork]}]}
124
125   CephStorageConfig:
126     type: OS::Heat::StructuredConfig
127     properties:
128       group: os-apply-config
129       config:
130         hiera:
131           hierarchy:
132             - heat_config_%{::deploy_config_name}
133             - ceph_extraconfig
134             - extraconfig
135             - ceph_cluster # provided by CephClusterConfig
136             - ceph
137             - '"%{::osfamily}"'
138             - common
139           datafiles:
140             common:
141               raw_data: {get_file: hieradata/common.yaml}
142             ceph_extraconfig:
143               mapped_data: {get_param: CephStorageExtraConfig}
144             extraconfig:
145               mapped_data: {get_param: ExtraConfig}
146             ceph:
147               raw_data: {get_file: hieradata/ceph.yaml}
148               mapped_data:
149                 ntp::servers: {get_input: ntp_servers}
150                 tripleo::packages::enable_install: {get_input: enable_package_install}
151                 ceph::profile::params::cluster_network: {get_input: ceph_cluster_network}
152                 ceph::profile::params::public_network: {get_input: ceph_public_network}
153
154   UpdateConfig:
155     type: OS::TripleO::Tasks::PackageUpdate
156
157   UpdateDeployment:
158     type: OS::Heat::SoftwareDeployment
159     properties:
160       config: {get_resource: UpdateConfig}
161       server: {get_resource: CephStorage}
162       input_values:
163         update_identifier:
164           get_param: UpdateIdentifier
165
166 outputs:
167   hosts_entry:
168     value:
169       str_replace:
170         template: "IP HOST.localdomain HOST"
171         params:
172           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, CephStorageHostnameResolveNetwork]}]}
173           HOST: {get_attr: [CephStorage, name]}
174   nova_server_resource:
175     description: Heat resource handle for the ceph storage server
176     value:
177       {get_resource: CephStorage}
178   storage_ip_address:
179     description: IP address of the server in the storage network
180     value: {get_attr: [StoragePort, ip_address]}
181   storage_mgmt_ip_address:
182     description: IP address of the server in the storage_mgmt network
183     value: {get_attr: [StorageMgmtPort, ip_address]}
184   config_identifier:
185     description: identifier which changes if the node configuration may need re-applying
186     value: {get_attr: [CephStorageDeployment, deploy_stdout]}