Skip to content

Instantly share code, notes, and snippets.

@psachin
Last active September 29, 2017 07:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psachin/85b89e125007bca0b4fc2d5bd2d19fa6 to your computer and use it in GitHub Desktop.
Save psachin/85b89e125007bca0b4fc2d5bd2d19fa6 to your computer and use it in GitHub Desktop.
Simple heat stack(Tested on quickstart environment with OpenStack Ocata release)
heat_template_version: 2016-10-14
description: Simple template to deploy a single compute instance. Need to change image name
parameters:
image:
type: string
description: Image name or id
default: cirros
resources:
psachin_instance-1:
type: OS::Nova::Server
properties:
key_name: { get_resource: mykey }
image: { get_param: image }
flavor: { get_resource: flavor-cirros}
networks:
- port: { get_resource: instance_port }
flavor-cirros:
type: OS::Nova::Flavor
properties:
name: "cirros"
ram: 100
vcpus: 1
disk: 1
mykey:
type: OS::Nova::KeyPair
properties:
name: psachin
save_private_key: true
ping-ssh:
type: OS::Neutron::SecurityGroup
properties:
rules:
- protocol: tcp
remote_ip_prefix: 0.0.0.0/0
port_range_min: 22
port_range_max: 22
- protocol: icmp
remote_ip_prefix: 0.0.0.0/0
public-net:
description: External network
type: OS::Neutron::ProviderNet
properties:
name: public-net
network_type: flat
physical_network: datacentre
router_external: true
public-net-subnet:
type: OS::Neutron::Subnet
properties:
name: public-subnet
network_id: { get_resource: public-net }
cidr: 192.168.24.0/24
allocation_pools: [{"start": "192.168.24.100", "end": "192.168.24.120"}]
enable_dhcp: false
gateway_ip: "192.168.24.1"
int-green:
description: internal network
type: OS::Neutron::Net
properties:
name: int-green
int-green-subnet:
type: OS::Neutron::Subnet
properties:
network_id: { get_resource: int-green }
cidr: 30.0.0.0/24
dns_nameservers: ["8.8.8.8"]
router-green:
type: OS::Neutron::Router
properties:
external_gateway_info: { network: { get_resource: public-net }}
router-green-interface:
type: OS::Neutron::RouterInterface
properties:
router: { get_resource: router-green }
subnet: { get_resource: int-green-subnet }
instance_port:
type: OS::Neutron::Port
properties:
network: { get_resource: int-green}
security_groups: [ { get_resource: ping-ssh } ]
fixed_ips:
- subnet_id: { get_resource: int-green-subnet }
floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network: { get_resource: public-net }
port_id: { get_resource: instance_port }
@psachin
Copy link
Author

psachin commented Jul 8, 2017

triple-quickstart environment( commit 0a5dc8de8df3ddbf1886b8416b55464b0910c7ba)

Download image

curl http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img -o cirros-0.3.5-x86_64-disk.img

Create glance image

openstack image create --public --container-format bare --file cirros-0.3.5-x86_64-disk.img cirros
```
openstack  network create ext-net --external --provider-physical-network datacentre --provider-network-type flat
openstack subnet create ext-subnet --network ext-net --subnet-range 192.168.24.0/24  --allocation-pool start=192.168.24.100,end=192.168.24.120 --no-dhcp --gateway 192.168.24.1
```

Launch stack using
```
openstack stack create --template test-stack.yml test-stack
```

Output
```
[stack@undercloud ]$ openstack server list
+--------------------------------------+-----------------------------------------------+--------+------------------------------------+------------+
| ID                                   | Name                                          | Status | Networks                           | Image Name |
+--------------------------------------+-----------------------------------------------+--------+------------------------------------+------------+
| c14904d2-bc35-48a3-bc75-7b778eb02acd | test-stack-test_instance-1-adgli2qymnzm       | ACTIVE | int-green=30.0.0.8, 192.168.24.110 | cirros     |
+--------------------------------------+-----------------------------------------------+--------+------------------------------------+------------+
```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment