Skip to content
Snippets Groups Projects
bioinfo_machine.yaml 1.67 KiB
Newer Older
Lukas Jelonek's avatar
Lukas Jelonek committed
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] }