Skip to content
Snippets Groups Projects
Commit 032c95b4 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Add heat example

parent 268fec77
No related branches found
No related tags found
No related merge requests found
heat_template_version: 2016-10-14
description: run a test instance and associate a floating ip
resources:
wait_condition:
type: OS::Heat::WaitCondition
properties:
handle: { get_resource: wait_handle }
count: 1
timeout: 600
wait_handle:
type: OS::Heat::WaitConditionHandle
network:
type: res::network
key:
type: res::key
ssh_access:
type: res::ssh
instance_port:
depends_on: [network, ssh_access]
type: OS::Neutron::Port
properties:
network: {get_attr: [network, name]}
security_groups:
- default
- { get_attr: [ssh_access, name] }
floating_ip:
type: OS::Nova::FloatingIP
properties:
pool: external_network
instance:
depends_on: [key, network, instance_port]
type: OS::Nova::Server
properties:
flavor: de.NBI.default
image: Ubuntu 16.04 Xenial 2017/04/19
networks:
- port: { get_resource: instance_port }
key_name: { get_attr: [key, name] }
user_data_format: RAW
user_data:
list_join:
- ''
- - {get_file: setup-bioinfo-desktop.sh}
- str_replace:
params:
wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
template: |
# notify heat that we are done here
wc_notify --insecure --data-binary '{"status": "SUCCESS"}'
association:
type: OS::Nova::FloatingIPAssociation
properties:
floating_ip: { get_resource: floating_ip }
server_id: { get_resource: instance }
outputs:
ip:
description: The floating IP address assigned to the server.
value: { get_attr: [floating_ip, ip] }
resource_registry:
res::network: network.yaml
res::ssh: ssh_access.yaml
res::key: setup_public_key.yaml
heat_template_version: 2016-10-14
parameters:
network_name:
description: The name of the created private network
type: string
default: default_network
external_network_name:
description: The name of the external network that is connected to the internet
type: string
default: external_network
description: Setup a default private network that is routed to an external network
resources:
internal_net:
type: OS::Neutron::Net
properties:
name: {get_param: network_name}
internal_subnet:
type: OS::Neutron::Subnet
properties:
network_id: { get_resource: internal_net }
cidr: "10.8.1.0/24"
ip_version: 4
internal_router:
type: OS::Neutron::Router
properties:
external_gateway_info:
network: {get_param: external_network_name }
internal_interface:
type: OS::Neutron::RouterInterface
properties:
router_id: { get_resource: internal_router }
subnet: { get_resource: internal_subnet }
outputs:
name:
description: The private network name.
value: {get_resource: internal_net}
#!/bin/bash
sudo apt-add-repository ppa:x2go/stable
apt update
apt upgrade
#apt install -y xfce4
apt install -y e17
apt install -y x2goserver x2goserver-xsession
apt install -y zsh
sed -i 's#/home/ubuntu:/bin/bash#/home/ubuntu:/bin/zsh#' /etc/passwd
heat_template_version: 2016-10-14
parameters:
name:
description: The name for the public key
type: string
default: default_key
key:
description: The public key
type: string
default: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArx3As2QTeJg46dCFhrpeGA7ZOTcTCzcHHEt1SUxbXZ1XqITm+a1Z6vswXnuV016Jq6OLWivFFA+ZlNX5lUljzmJIYu1ke6u0217x3xTHbio6W4acZ5H5y3lAh/hsEGVh8GHXu8IoTxbEueiCbHufsHXlMZ8Ielz/Oex5DJBBGL8/ZnpnvgWwD2x2GwIoV6nQmWJolwksQ7AH0yKT6GECq+2jrVnPWH3/FQ2dHHErzCWuPBkeOhGY0rjh3a9vtOoxakNEw9/zNEQqJ54xcBJkWS3XbG3vv/w73yFcMSW1vnuJquMzAzPDx58rJicoVpGIA+4fUABOj/D+Z8GsxgVupQ== ljelonek@tabaqui
description: Upload a public key
resources:
public_key:
type: OS::Nova::KeyPair
properties:
name: {get_param: name}
public_key: { get_param : key }
outputs:
name:
value: {get_param: name}
heat_template_version: 2016-10-14
description: Creates a security group for ssh access
parameters:
rule_name:
description: The name of the security group
type: string
default: SSH Access
resources:
ssh_access:
type: OS::Neutron::SecurityGroup
properties:
name: {get_param: rule_name}
rules:
- protocol: tcp
remote_ip_prefix: 0.0.0.0/0
port_range_min: 22
port_range_max: 22
outputs:
name:
description: The ssh access rule
value: {get_param: rule_name }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment