[OpenStack Heat] get_started.template

1.Prepare image

[root@chen tests]# glance image-create --name F17-x86_64-cfntools--disk-format=qcow2 --container-format=bare --is-public=true --file=F17-x86_64-cfntools.qcow2



2.Prepare network ,iptables rules and keypair


Assume neutron service can work well.

# Create flat network.

[root@chen tests]# neutron net-create net_flat --provider:network_type flat--provider:physical_network physnet1

[root@chen tests]# neutron subnet-create net_flat 10.20.1.0/24 --namesubnet_flat --gateway 10.20.1.1

# List all nets


# Routing 169.254.169.254 metadata ip to 10.11.0.16:8775

# Add another address to br-int,important, if not done, key may can not be injected into vm

[root@chen tests]# sudo ifconfig br-int:1 10.20.1.1

[root@chen tests]# sudo iptables -t nat -A PREROUTING -d 169.254.169.254/32 -p tcp -m tcp--dport 80 -j DNAT --to-destination 10.11.0.16:8775

[root@chen tests]# sudo iptables-save

# Create keypair

[root@chen tests]# ssh-keygen -t rsa

select 'y' if need, anddo not input password to avoidlater input when ssh

[root@chen tests]# nova keypair-add --pub_key ~/.ssh/id_rsa.pub root_key


3.Using Heat CLI and shell scripts to verify.


[OpenStack Heat] get_started.template_第1张图片


4.SSH to VM to verify

[root@chen tests]# ssh [email protected]

[ec2-user@wordpress-MyInstance-xghq7ah4xu7h ~]$

Now can login the VM successfully, and can do anything in this VM.


你可能感兴趣的:(openstack,Heat)