Make puppet-applying *Post resources depend on hieradata
[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
43 resources:
44   CephStorage:
45     type: OS::Nova::Server
46     properties:
47       image: {get_param: Image}
48       image_update_policy: {get_param: ImageUpdatePolicy}
49       flavor: {get_param: Flavor}
50       key_name: {get_param: KeyName}
51       networks:
52         - network: ctlplane
53       user_data_format: SOFTWARE_CONFIG
54       user_data: {get_resource: NodeUserData}
55
56   NodeUserData:
57     type: OS::TripleO::NodeUserData
58
59   StoragePort:
60     type: OS::TripleO::CephStorage::Ports::StoragePort
61     properties:
62       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
63
64   StorageMgmtPort:
65     type: OS::TripleO::CephStorage::Ports::StorageMgmtPort
66     properties:
67       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
68
69   NetworkConfig:
70     type: OS::TripleO::CephStorage::Net::SoftwareConfig
71     properties:
72       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
73       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
74
75   NetIpSubnetMap:
76     type: OS::TripleO::Network::Ports::NetIpMap
77     properties:
78       StorageIp: {get_attr: [StoragePort, ip_subnet]}
79       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_subnet]}
80
81   NetworkDeployment:
82     type: OS::TripleO::SoftwareDeployment
83     properties:
84       config: {get_resource: NetworkConfig}
85       server: {get_resource: CephStorage}
86
87   CephStorageDeployment:
88     type: OS::Heat::StructuredDeployment
89     properties:
90       config: {get_resource: CephStorageConfig}
91       server: {get_resource: CephStorage}
92       input_values:
93         ntp_servers:
94           str_replace:
95             template: '["server"]'
96             params:
97               server: {get_param: NtpServer}
98         enable_package_install: {get_param: EnablePackageInstall}
99         ceph_cluster_network: {get_attr: [NetIpSubnetMap, net_ip_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}
100         ceph_public_network: {get_attr: [NetIpSubnetMap, net_ip_map, {get_param: [ServiceNetMap, CephPublicNetwork]}]}
101
102   CephStorageConfig:
103     type: OS::Heat::StructuredConfig
104     properties:
105       group: os-apply-config
106       config:
107         hiera:
108           hierarchy:
109             - heat_config_%{::deploy_config_name}
110             - ceph_cluster # provided by CephClusterConfig
111             - ceph
112             - '"%{::osfamily}"'
113             - common
114           datafiles:
115             common:
116               raw_data: {get_file: hieradata/common.yaml}
117             ceph:
118               raw_data: {get_file: hieradata/ceph.yaml}
119               mapped_data:
120                 ntp::servers: {get_input: ntp_servers}
121                 enable_package_install: {get_input: enable_package_install}
122                 ceph::profile::params::cluster_network: {get_input: ceph_cluster_network}
123                 ceph::profile::params::public_network: {get_input: ceph_public_network}
124
125   UpdateConfig:
126     type: OS::TripleO::Tasks::PackageUpdate
127
128   UpdateDeployment:
129     type: OS::Heat::SoftwareDeployment
130     properties:
131       config: {get_resource: UpdateConfig}
132       server: {get_resource: CephStorage}
133       input_values:
134         update_identifier:
135           get_param: UpdateIdentifier
136
137 outputs:
138   hosts_entry:
139     value:
140       str_replace:
141         template: "IP HOST"
142         params:
143           IP: {get_attr: [CephStorage, networks, ctlplane, 0]}
144           HOST: {get_attr: [CephStorage, name]}
145   nova_server_resource:
146     description: Heat resource handle for the ceph storage server
147     value:
148       {get_resource: CephStorage}
149   storage_ip_address:
150     description: IP address of the server in the storage network
151     value: {get_attr: [StoragePort, ip_address]}
152   storage_mgmt_ip_address:
153     description: IP address of the server in the storage_mgmt network
154     value: {get_attr: [StorageMgmtPort, ip_address]}
155   config_identifier:
156     description: identifier which changes if the node configuration may need re-applying
157     value: {get_attr: [CephStorageDeployment, deploy_stdout]}
158