Created
December 14, 2018 05:07
-
-
Save ualmtorres/038294607e6e376a3848f5b651d44af6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heat_template_version: 2016-04-08 | |
description: > | |
Sample Lab template. | |
This template creates two OpenStack instances. The first one is aprovisioned with Docker. The second one is aprovisoned with nginx. The post-installation script assumes that an Ubuntu image is selected. | |
parameters: | |
key_name: | |
type: string | |
description: Name of a KeyPair to enable SSH access to the instance | |
instance_type: | |
type: string | |
description: Instance type | |
default: medium | |
image_id: | |
type: string | |
description: > | |
Name or ID of the image to use for the instance. | |
default: Ubuntu 16.04 LTS | |
network_name: | |
type: string | |
description: > | |
Network to place instance in. | |
default: mtorres-net | |
resources: | |
docker: | |
type: OS::Nova::Server | |
properties: | |
name: lab-docker | |
image: { get_param: image_id } | |
flavor: { get_param: instance_type } | |
key_name: { get_param: key_name } | |
networks: | |
- network: { get_param: network_name } | |
user_data: | |
str_replace: | |
template: | | |
#!/bin/bash -v | |
echo "Instalando Docker" | |
apt-get update | |
apt-get install -y \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - | |
apt-key fingerprint 0EBFCD88 | |
add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) \ | |
stable" | |
apt-get update | |
apt-get install -y docker-ce | |
groupadd docker | |
usermod -aG docker ubuntu | |
systemctl enable docker | |
echo "Instalando Docker Compose" | |
curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
echo network_name >> /home/ubuntu/borrar.txt | |
params: | |
network_name = { get_param: network_name } | |
nginx: | |
type: OS::Nova::Server | |
properties: | |
name: lab-nginx | |
image: { get_param: image_id } | |
flavor: { get_param: instance_type } | |
key_name: { get_param: key_name } | |
networks: | |
- network: { get_param: network_name } | |
user_data: | |
str_replace: | |
template: | | |
#!/bin/bash -v | |
echo "Instalando Nginx" | |
apt-get update | |
apt-get install -y nginx | |
echo network_name >> /home/ubuntu/borrar.txt | |
params: | |
network_name = { get_param: network_name } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment