Skip to content

Instantly share code, notes, and snippets.

@toabctl
Created March 19, 2019 12:16
Show Gist options
  • Save toabctl/b73322061ab7b91eaa71f1966ffbe3cd to your computer and use it in GitHub Desktop.
Save toabctl/b73322061ab7b91eaa71f1966ffbe3cd to your computer and use it in GitHub Desktop.
OpenStack Heat template example
heat_template_version: 2016-10-14
description: >
Template for deploying Ardana in a multinode setup
parameters:
key_name:
type: string
label: Key Name
description: Name of key-pair to be used for compute instance
default: engcloud-cloud-ci
image_id:
type: string
label: Image ID
description: Image to be used for compute instance
default: cleanvm-jeos-SLE12SP3
instance_type_controller:
type: string
label: Instance Type
description: Type of instance (flavor) to be used for the controller
default: m1.xlarge
instance_type_compute:
type: string
label: Instance Type
description: Type of instance (flavor) to be used for compute nodes
default: m1.large
resources:
# security groups
security-group-base:
type: OS::Neutron::SecurityGroup
properties:
description: Allow ICMP and ssh
rules:
- protocol: icmp
# We need at least port 22 (ssh), 79 (ardana-packager), 80/443
- protocol: tcp
# At least DNS and ntp
- protocol: udp
port_range_min: 53
port_range_max: 124
# networks
network_mgmt:
type: OS::Neutron::Net
network_ardana:
type: OS::Neutron::Net
# subnet
subnet_mgmt:
type: OS::Neutron::Subnet
properties:
network_id: { get_resource: network_mgmt }
cidr: "192.168.245.0/24"
ip_version: 4
gateway_ip: 192.168.245.1
subnet_ardana:
type: OS::Neutron::Subnet
properties:
network_id: { get_resource: network_ardana }
cidr: "192.168.110.0/24"
ip_version: 4
gateway_ip: null
# router
router_mgmt:
type: OS::Neutron::Router
properties:
external_gateway_info:
network: floating
router_mgmt_interface:
type: OS::Neutron::RouterInterface
properties:
router_id: { get_resource: router_mgmt }
subnet_id: { get_resource: subnet_mgmt }
# floating IPs
deployer-controller-floatingip:
type: OS::Neutron::FloatingIP
properties:
floating_network: floating
# instances
deployer-controller:
type: OS::Nova::Server
properties:
key_name: { get_param: key_name }
image: { get_param: image_id }
flavor: { get_param: instance_type_controller }
security_groups:
- { get_resource: security-group-base }
networks:
- network: fixed
- network: { get_resource: network_mgmt }
- network: { get_resource: network_ardana }
compute1:
type: OS::Nova::Server
properties:
key_name: { get_param: key_name }
image: { get_param: image_id }
flavor: { get_param: instance_type_compute }
security_groups:
- { get_resource: security-group-base }
networks:
- network: { get_resource: network_mgmt }
- network: { get_resource: network_ardana }
compute2:
type: OS::Nova::Server
properties:
key_name: { get_param: key_name }
image: { get_param: image_id }
flavor: { get_param: instance_type_compute }
security_groups:
- { get_resource: security-group-base }
networks:
- network: { get_resource: network_mgmt }
- network: { get_resource: network_ardana }
deployer-controller-floating-assignment:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id: { get_resource: deployer-controller-floatingip }
port_id: {get_attr: [deployer-controller, addresses, fixed, 0, port]}
outputs:
# deployer-controller
deployer-controller-ip-floating:
description: Floating IP address of the deployer-controller node
value: { get_attr: [deployer-controller-floatingip, floating_ip_address] }
deployer-controller-net-fixed-ip:
description: IP address of the deployer-controller in the fixed network
value: { get_attr: [deployer-controller, networks, fixed, 0]}
deployer-controller-net-ardana-ip:
description: IP address of the deployer-controller in the ardana network
value: { get_attr: [deployer-controller, networks, { get_resource: network_ardana }, 0]}
deployer-controller-net-mgmt-ip:
description: IP address of the deployer-controller in the mgmt network
value: { get_attr: [deployer-controller, networks, { get_resource: network_mgmt }, 0]}
# compute1
compute1-net-ardana-ip:
description: IP address of the compute1 node in the ardana network
value: { get_attr: [compute1, networks, { get_resource: network_ardana }, 0]}
compute1-net-mgmt-ip:
description: IP address of the compute1 node in the mgmt network
value: { get_attr: [compute1, networks, { get_resource: network_mgmt }, 0]}
# compute2
compute2-net-ardana-ip:
description: IP address of the compute2 node in the ardana network
value: { get_attr: [compute2, networks, { get_resource: network_ardana }, 0]}
compute2-net-mgmt-ip:
description: IP address of the compute2 node in the mgmt network
value: { get_attr: [compute2, networks, { get_resource: network_mgmt }, 0]}
# network info
network-mgmt-id:
description: Neutron Network ID of management network
value: { get_resource: network_mgmt }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment