Skip to content

Instantly share code, notes, and snippets.

@tvlooy
Created September 16, 2016 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tvlooy/da95ae233e28515236e4d5892f896b5d to your computer and use it in GitHub Desktop.
Save tvlooy/da95ae233e28515236e4d5892f896b5d to your computer and use it in GitHub Desktop.
##
## openstack stack create -t example.heat.yml example-1
##
heat_template_version: 2016-04-08
description: |
Deploy example
resources:
server_root_pw:
type: OS::Heat::RandomString
nginx_config:
type: OS::Heat::SoftwareConfig
properties:
group: ansible
config: |
---
- name: Install and run Nginx
connection: local
hosts: localhost
tasks:
- name: Install Nginx
yum:
name: nginx
state: installed
- name: Start Nginx
service:
name: nginx
state: started
enabled: yes
deploy_nginx:
type: OS::Heat::SoftwareDeployment
properties:
config:
get_resource: nginx_config
server:
get_resource: server_www1
server_www1_floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network_id: public
server_www1:
type: OS::Nova::Server
properties:
name: www1
image: centos-7-64bit
flavor: small
key_name: my_openstack_key
admin_pass: { get_attr: [ server_root_pw, value ] }
user_data_format: SOFTWARE_CONFIG
association:
type: OS::Nova::FloatingIPAssociation
properties:
floating_ip: { get_resource: server_www1_floating_ip }
server_id: { get_resource: server_www1 }
outputs:
server_www1_ip:
description: The public IPv4 address of server www1
value:
get_attr: [ server_www1_floating_ip, floating_ip_address ]
server_root_pw:
description: Server root password
value:
get_attr: [ server_root_pw, value ]
@tvlooy
Copy link
Author

tvlooy commented Sep 16, 2016

$ openstack stack show example-1

+-----------------------+-----------------------------------------------------------------------------------------------------------------------------+
| Field                 | Value                                                                                                                       |
+-----------------------+-----------------------------------------------------------------------------------------------------------------------------+
| id                    | 8f902367-b38b-475f-b4c7-be0dbeedcc4c                                                                                        |
| stack_name            | example-1                                                                                                                      |
| description           | Deploy example                                                                                                              |
|                       |                                                                                                                             |
| creation_time         | 2016-09-16T14:19:49                                                                                                         |
| updated_time          | None                                                                                                                        |
| stack_status          | CREATE_FAILED                                                                                                               |
| stack_status_reason   | Create timed out                                                                                                            |
| parameters            | OS::project_id: 5c61aa2a6e761c02843052b3975c82f5                                                                            |
|                       | OS::stack_id: 8f984357-b38b-475f-b4c7-be0dbeedcc4c                                                                          |
|                       | OS::stack_name: example-1                                                                                                      |
|                       |                                                                                                                             |
| outputs               | - description: Server root password                                                                                         |
|                       |   output_key: server_root_pw                                                                                                |
|                       |   output_value: dfadHJHJDHFiojdfa87684hdhfg                                                                            |
|                       | - description: The public IPv4 address of server www1                                                                       |
|                       |   output_key: server_www1_ip                                                                                                |
|                       |   output_value: xxx.xxx.xxx.xxx                                                                                             |
|                       |                                                                                                                             |
| links                 | - href: https://foo:8004/v1/5c61aa2a6e664c02843052b3975c82f5/stacks/example-1/8f903357-b38b-475f-b4c7-be0dbeedcc4c |
|                       |   rel: self                                                                                                                 |
|                       |                                                                                                                             |
| disable_rollback      | True                                                                                                                        |
| parent                | None                                                                                                                        |
| tags                  | null                                                                                                                        |
|                       | ...                                                                                                                         |
|                       |                                                                                                                             |
| stack_user_project_id | b859719de8ac42b97197a1b297df107b                                                                                            |
| capabilities          | []                                                                                                                          |
| notification_topics   | []                                                                                                                          |
| timeout_mins          | None                                                                                                                        |
| stack_owner           | None                                                                                                                        |
+-----------------------+-----------------------------------------------------------------------------------------------------------------------------+

@tvlooy
Copy link
Author

tvlooy commented Sep 16, 2016

The part that times out is the OS:Heat:SoftwareDeployment.

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