blob: 5e0b69a6454116c983a5fff27b599bac44c877e5 [file] [log] [blame]
{#
Copyright 2017-present Open Networking Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#}
tosca_definitions_version: tosca_simple_yaml_1_0
imports:
- custom_types/deployment.yaml
- custom_types/node.yaml
- custom_types/site.yaml
- custom_types/sitedeployment.yaml
description: Adds OpenStack compute nodes
topology_template:
node_templates:
# Site/Deployment, fully defined in deployment.yaml
{{ site_name }}:
type: tosca.nodes.Site
properties:
name: {{ site_name }}
must-exist: true
{{ deployment_type }}:
type: tosca.nodes.Deployment
properties:
name: {{ deployment_type }}
must-exist: true
# OpenStack compute nodes
{% for node in groups['compute'] %}
{% for ext_if in computenode_fabric_interfaces %}
{% set ansible_ext_if = 'ansible_' ~ ext_if | regex_replace('\W', '_') %}
{% if hostvars[node][ansible_ext_if] is defined and 'ipv4' in hostvars[node][ansible_ext_if] %}
{% set node_interface = hostvars[node][ansible_ext_if] %}
# Compute node: {{ node }}, with interface {{ ansible_ext_if }}
{{ hostvars[node]['ansible_hostname'] }}:
type: tosca.nodes.Node
properties:
name: {{ hostvars[node]['ansible_hostname'] }}
requirements:
- site_deployment:
node: {{ site_name }}_{{ deployment_type }}
relationship: tosca.relationships.BelongsToOne
{{ site_name }}_{{ deployment_type }}:
type: tosca.nodes.SiteDeployment
requirements:
- site:
node: {{ site_name }}
relationship: tosca.relationships.BelongsToOne
- deployment:
node: {{ deployment_type }}
relationship: tosca.relationships.BelongsToOne
{% endif %}
{% endfor %}
{% endfor %}