首页 > 代码库 > openstack 使用heat 创建stack

openstack 使用heat 创建stack

重建stack:

http://CONTROLLER_IP:8004/v1/PROJECT_ID/stacks

method: post


header:

content-Type:application/json
Accept:application/json
X-Auth-Token:TOKEN

body:

{
	"files": {
		"myfile": "#!/bin/bash\nwget \"http://45.35.12.10/MongoDB_install.sh\" -P /tmp/\ncd /tmp\nchmod +x MongoDB_install.sh\n./MongoDB_install.sh DBROOT_USER DBROOT_PASSWD OS_PASSWD\nrm -f MongoDB_install.sh"
	},
	"disable_rollback": true,
	"stack_name": "STACK_NAME",
	"template": {
		"heat_template_version": "2013-05-23",
		"resources": {
			"instance_port": {
				"type": "OS::Neutron::Port",
				"properties": {
					"network": "int_net"
				}
			},
			"instance": {
				"type": "OS::Nova::Server",
				"properties": {
				    "name": "INSTANCE_NAME",
					"key_name": "KEY_NAME",
					"flavor": "FLAVOR_ID",
					"image": "IMAGE_ID",
					"user_data": {
						"get_file": "myfile"
					},
					"networks": [
						{
							"port": {
								"get_resource": "instance_port"
							}
						}
					]
				}
			},
			"floatingip": {
				"type": "OS::Neutron::FloatingIP",
                "properties": {
		            "floating_network": "ext_net",
		            "floating_ip_address": "FLOATING_IP"
	            }
			},
			"floatingip_association": {
				"type": "OS::Nova::FloatingIPAssociation",
				"properties": {
					"floating_ip": {
						"get_resource": "floatingip"
					},
					"server_id": {
						"get_resource": "instance"
					}
				}
			}
		}
	}
}

获取应用重装状态

URL: 

http://CONTROLLER_IP:8774/v2.1/servers/INSTANCE_ID/action

method: post

Header:

Content-Type:application/json
Accept:application/json
X-Auth-Token:TOKEN



openstack 使用heat 创建stack