140 lines
3.9 KiB
YAML
140 lines
3.9 KiB
YAML
|
heat_template_version: 2013-05-23
|
||
|
|
||
|
description: >
|
||
|
HOT template to deploy one compute node into an xisting neutron tenant network and
|
||
|
assign floating IP address to the server so they are routable from the
|
||
|
public network.
|
||
|
|
||
|
parameters:
|
||
|
key_name:
|
||
|
type: string
|
||
|
description: Name of keypair to assign to servers
|
||
|
image:
|
||
|
type: string
|
||
|
description: Name of image to use for servers
|
||
|
flavor:
|
||
|
type: string
|
||
|
description: Flavor to use for servers
|
||
|
public_net_id:
|
||
|
type: string
|
||
|
description: >
|
||
|
ID of public network for which floating IP addresses will be allocated
|
||
|
private_net_id:
|
||
|
type: string
|
||
|
description: ID of private network into which servers get deployed
|
||
|
private_subnet_id:
|
||
|
type: string
|
||
|
description: ID of private sub network into which servers get deployed
|
||
|
master_node_ip:
|
||
|
type: string
|
||
|
description: IP address of the Master node.
|
||
|
#index_name:
|
||
|
# type: string
|
||
|
# description: IP address of the Master node.
|
||
|
|
||
|
resources:
|
||
|
|
||
|
node_wait_handle:
|
||
|
type: "AWS::CloudFormation::WaitConditionHandle"
|
||
|
|
||
|
node_wait_condition:
|
||
|
type: "AWS::CloudFormation::WaitCondition"
|
||
|
depends_on:
|
||
|
- compute_node
|
||
|
properties:
|
||
|
Handle:
|
||
|
get_resource: node_wait_handle
|
||
|
Timeout: "300"
|
||
|
|
||
|
secgroup_all_open:
|
||
|
type: "OS::Neutron::SecurityGroup"
|
||
|
properties:
|
||
|
rules:
|
||
|
- protocol: icmp
|
||
|
- protocol: tcp
|
||
|
- protocol: udp
|
||
|
|
||
|
compute_node:
|
||
|
type: OS::Nova::Server
|
||
|
properties:
|
||
|
name: compute
|
||
|
image: { get_param: image }
|
||
|
flavor: { get_param: flavor }
|
||
|
key_name: { get_param: key_name }
|
||
|
networks:
|
||
|
- port: { get_resource: compute_port }
|
||
|
user_data_format: RAW
|
||
|
user_data:
|
||
|
str_replace:
|
||
|
template: |
|
||
|
#!/bin/sh
|
||
|
|
||
|
cat > /etc/yum.repos.d/epel-7.repo << EOF
|
||
|
[epel-7]
|
||
|
name=epel-7
|
||
|
baseurl=http://192.168.33.200/install/post/otherpkgs/el7/epel
|
||
|
enabled=1
|
||
|
gpgcheck=0
|
||
|
EOF
|
||
|
|
||
|
cat > /etc/yum.repos.d/rdo-openstack.repo << EOF
|
||
|
[rdo-openstack]
|
||
|
name=rdo-openstack
|
||
|
baseurl=http://192.168.33.200/install/post/otherpkgs/el7/rdo-openstack
|
||
|
enabled=1
|
||
|
gpgcheck=0
|
||
|
EOF
|
||
|
|
||
|
yum -y remove NetworkManager
|
||
|
chkconfig network on
|
||
|
|
||
|
yum -y install heat-cfntools
|
||
|
|
||
|
myip=$(ip addr show eth0 | awk '$1 == "inet" {print $2}' | cut -f1 -d/)
|
||
|
myip_last_octet=${myip##*.}
|
||
|
|
||
|
cfn-signal -e0 --data 'OK' -r 'Setup complete' '$WAIT_HANDLE'
|
||
|
params:
|
||
|
"$MASTER_NODE_IP":
|
||
|
get_param: master_node_ip
|
||
|
"$WAIT_HANDLE":
|
||
|
get_resource: node_wait_handle
|
||
|
networks:
|
||
|
- port:
|
||
|
get_resource: compute_node_eth0
|
||
|
|
||
|
compute_node_eth0:
|
||
|
type: OS::Neutron::Port
|
||
|
properties:
|
||
|
network_id: { get_param: private_net_id }
|
||
|
fixed_ips:
|
||
|
- subnet_id: { get_param: private_subnet_id }
|
||
|
security_groups: [{ get_resource: secgroup_all_open }]
|
||
|
|
||
|
compute_floating_ip:
|
||
|
type: OS::Neutron::FloatingIP
|
||
|
properties:
|
||
|
floating_network_id: { get_param: public_net_id }
|
||
|
port_id: { get_resource: compute_node_eth0 }
|
||
|
|
||
|
compute_security_group:
|
||
|
type: OS::Neutron::SecurityGroup
|
||
|
properties:
|
||
|
description: Add security group rules for server
|
||
|
name: security-group
|
||
|
rules:
|
||
|
- remote_ip_prefix: 0.0.0.0/0
|
||
|
protocol: tcp
|
||
|
port_range_min: 22
|
||
|
port_range_max: 22
|
||
|
- remote_ip_prefix: 0.0.0.0/0
|
||
|
protocol: icmp
|
||
|
|
||
|
outputs:
|
||
|
compute_node_ip:
|
||
|
description: IP address of compute node in private network
|
||
|
value: { get_attr: [ compute_node_eth0, fixed_ips, 0, ip_address ] }
|
||
|
compute_node_external_ip:
|
||
|
description: Floating IP address of compute node in public network
|
||
|
value: { get_attr: [ compute_floating_ip, floating_ip_address ] }
|