Merge "puppet: wire in osfamily hieradata support"
[apex-tripleo-heat-templates.git] / puppet / swift-storage-puppet.yaml
1 heat_template_version: 2014-10-16
2 description: 'Common Swift Storage Configuration'
3 parameters:
4   Flavor:
5     description: Flavor for Swift storage nodes to request when deploying.
6     type: string
7     constraints:
8       - custom_constraint: nova.flavor
9   HashSuffix:
10     default: unset
11     description: A random string to be used as a salt when hashing to determine mappings
12       in the ring.
13     hidden: true
14     type: string
15   Image:
16     default: overcloud-swift-storage
17     type: string
18   KeyName:
19     default: default
20     description: Name of an existing EC2 KeyPair to enable SSH access to the instances
21     type: string
22   MountCheck:
23     default: 'false'
24     description: Value of mount_check in Swift account/container/object -server.conf
25     type: boolean
26   MinPartHours:
27     type: number
28     default: 1
29     description: The minimum time (in hours) before a partition in a ring can be moved following a rebalance.
30   PartPower:
31     default: 10
32     description: Partition Power to use when building Swift rings
33     type: number
34   Replicas:
35     type: number
36     default: 3
37     description: How many replicas to use in the swift rings.
38   SnmpdReadonlyUserName:
39     default: ro_snmp_user
40     description: The user name for SNMPd with readonly rights running on all Overcloud nodes
41     type: string
42   SnmpdReadonlyUserPassword:
43     default: unset
44     description: The user password for SNMPd with readonly rights running on all Overcloud nodes
45     type: string
46     hidden: true
47   NtpServer:
48     type: string
49     default: ''
50   EnablePackageInstall:
51     default: 'false'
52     description: Set to true to enable package installation via Puppet
53     type: boolean
54
55 resources:
56
57   SwiftStorage:
58     type: OS::Nova::Server
59     properties:
60       image: {get_param: Image}
61       flavor: {get_param: Flavor}
62       key_name: {get_param: KeyName}
63       user_data_format: SOFTWARE_CONFIG
64       networks:
65         - network: ctlplane
66
67   SwiftStorageHieraConfig:
68     type: OS::Heat::StructuredConfig
69     properties:
70       group: os-apply-config
71       config:
72         hiera:
73           hierarchy:
74             - heat_config_%{::deploy_config_name}
75             - object
76             - '"%{::osfamily}"'
77             - common
78           datafiles:
79             common:
80               raw_data: {get_file: hieradata/common.yaml}
81             object:
82               raw_data: {get_file: hieradata/object.yaml}
83               oac_data: # data we map in from other OAC configurations
84                 tripleo::ringbuilder::devices: swift.devices
85               mapped_data: # data supplied directly to this deployment configuration, etc
86                 swift::swift_hash_suffix: { get_input: swift_hash_suffix }
87                 tripleo::ringbuilder::part_power: { get_input: swift_part_power }
88                 tripleo::ringbuilder::replicas: {get_input: swift_replicas }
89                 # Swift
90                 swift::storage::all::storage_local_net_ip: {get_input: local_ip}
91                 swift_mount_check: {get_input: swift_mount_check }
92                 tripleo::ringbuilder::min_part_hours: { get_input: swift_min_part_hours }
93                 ntp::servers: {get_input: ntp_servers}
94                 # NOTE(dprince): build_ring support is currently not wired in.
95                 # See: https://review.openstack.org/#/c/109225/
96                 tripleo::ringbuilder::build_ring: True
97                 enable_package_install: {get_input: enable_package_install}
98
99
100   SwiftStorageHieraDeploy:
101     type: OS::Heat::StructuredDeployment
102     properties:
103       server: {get_resource: SwiftStorage}
104       config: {get_resource: SwiftStorageHieraConfig}
105       signal_transport: NO_SIGNAL
106       input_values:
107         local_ip: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
108         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
109         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
110         swift_hash_suffix: {get_param: HashSuffix}
111         swift_mount_check: {get_param: MountCheck}
112         swift_min_part_hours: {get_param: MinPartHours}
113         swift_part_power: {get_param: PartPower}
114         swift_replicas: { get_param: Replicas}
115         ntp_servers:
116           str_replace:
117             template: '["server"]'
118             params:
119               server: {get_param: NtpServer}
120         enable_package_install: {get_param: EnablePackageInstall}
121
122 outputs:
123   hosts_entry:
124     value:
125       str_replace:
126         template: "IP HOST HOST.novalocal"
127         params:
128           IP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
129           HOST: {get_attr: [SwiftStorage, name]}
130   nova_server_resource:
131     description: Heat resource handle for the swift storage server
132     value:
133       {get_resource: SwiftStorage}
134   swift_device:
135     description: Swift device formatted for swift-ring-builder
136     value:
137       str_replace:
138         template: 'r1z1-IP:%PORT%/d1'
139         params:
140           IP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}