Web Server Stack Template
heat_template_version: 2021-04-16
description: Isolated web server with network, security group and floating IP.
parameters:
image:
type: string
description: Operating system image
default: Ubuntu 22.04 Updated
flavor:
type: string
description: VM size (Nano is 2 vCPU, 2 GB RAM)
default: Nano
volume_size:
type: number
description: Boot volume size in GB
default: 30
public_network:
type: string
description: Public network for floating IP
default: Public
key_name:
type: string
description: Your SSH key pair name
resources:
app_network:
type: OS::Neutron::Net
properties:
name: my-stack-network
app_subnet:
type: OS::Neutron::Subnet
properties:
network: { get_resource: app_network }
cidr: 10.100.0.0/24
dns_nameservers: [8.8.8.8, 8.8.4.4]
app_router:
type: OS::Neutron::Router
properties:
external_gateway_info:
network: { get_param: public_network }
router_interface:
type: OS::Neutron::RouterInterface
properties:
router: { get_resource: app_router }
subnet: { get_resource: app_subnet }
web_sg:
type: OS::Neutron::SecurityGroup
properties:
name: my-stack-sg
rules:
- { direction: ingress, protocol: tcp, port_range_min: 22, port_range_max: 22, remote_ip_prefix: 0.0.0.0/0 }
- { direction: ingress, protocol: tcp, port_range_min: 80, port_range_max: 80, remote_ip_prefix: 0.0.0.0/0 }
- { direction: ingress, protocol: tcp, port_range_min: 443, port_range_max: 443, remote_ip_prefix: 0.0.0.0/0 }
- { direction: ingress, protocol: icmp, remote_ip_prefix: 0.0.0.0/0 }
web_server:
type: OS::Nova::Server
properties:
name: my-stack-webserver
flavor: { get_param: flavor }
key_name: { get_param: key_name }
networks:
- network: { get_resource: app_network }
security_groups:
- { get_resource: web_sg }
block_device_mapping_v2:
- boot_index: 0
delete_on_termination: true
image: { get_param: image }
volume_size: { get_param: volume_size }
user_data_format: RAW
user_data: |
#!/bin/bash
apt-get update -y && apt-get install -y nginx
echo "<h1>NeevCloud Orchestration</h1>" > /var/www/html/index.html
systemctl enable nginx && systemctl start nginx
floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network: { get_param: public_network }
floating_ip_assoc:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id: { get_resource: floating_ip }
port_id: { get_attr: [web_server, addresses, { get_resource: app_network }, 0, port] }
outputs:
web_url:
description: Web server URL
value:
str_replace:
template: http://HOST
params:
HOST: { get_attr: [floating_ip, floating_ip_address] }What it creates
Last updated