blob: 5e0b69a6454116c983a5fff27b599bac44c877e5 [file] [log] [blame]
Matteo Scandolo3896c472017-08-01 13:31:42 -07001{#
2Copyright 2017-present Open Networking Foundation
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15#}
16
Zack Williams682450e2016-11-19 09:04:41 -070017tosca_definitions_version: tosca_simple_yaml_1_0
18
19imports:
Matteo Scandolo1ed76b82017-12-05 13:58:22 -080020 - custom_types/deployment.yaml
21 - custom_types/node.yaml
22 - custom_types/site.yaml
23 - custom_types/sitedeployment.yaml
Zack Williams682450e2016-11-19 09:04:41 -070024
Zack Williamsa2763112017-01-03 11:38:38 -070025description: Adds OpenStack compute nodes
Zack Williams682450e2016-11-19 09:04:41 -070026
27topology_template:
28 node_templates:
29
30# Site/Deployment, fully defined in deployment.yaml
31 {{ site_name }}:
32 type: tosca.nodes.Site
Zack Williamsa2763112017-01-03 11:38:38 -070033 properties:
Matteo Scandolo1ed76b82017-12-05 13:58:22 -080034 name: {{ site_name }}
35 must-exist: true
Zack Williams682450e2016-11-19 09:04:41 -070036
37 {{ deployment_type }}:
38 type: tosca.nodes.Deployment
Zack Williamsa2763112017-01-03 11:38:38 -070039 properties:
Matteo Scandolo1ed76b82017-12-05 13:58:22 -080040 name: {{ deployment_type }}
41 must-exist: true
Zack Williams682450e2016-11-19 09:04:41 -070042
Zack Williamsa2763112017-01-03 11:38:38 -070043# OpenStack compute nodes
Zack Williams5223dd92017-02-28 23:38:02 -070044{% for node in groups['compute'] %}
Zack Williams2f5f2bd2017-12-01 15:04:22 -070045{% for ext_if in computenode_fabric_interfaces %}
Zack Williams6ccbed22017-06-26 13:18:05 -070046{% set ansible_ext_if = 'ansible_' ~ ext_if | regex_replace('\W', '_') %}
47{% if hostvars[node][ansible_ext_if] is defined and 'ipv4' in hostvars[node][ansible_ext_if] %}
48{% set node_interface = hostvars[node][ansible_ext_if] %}
49
50# Compute node: {{ node }}, with interface {{ ansible_ext_if }}
Zack Williams682450e2016-11-19 09:04:41 -070051 {{ hostvars[node]['ansible_hostname'] }}:
52 type: tosca.nodes.Node
Matteo Scandolo1ed76b82017-12-05 13:58:22 -080053 properties:
54 name: {{ hostvars[node]['ansible_hostname'] }}
55 requirements:
56 - site_deployment:
57 node: {{ site_name }}_{{ deployment_type }}
58 relationship: tosca.relationships.BelongsToOne
59
60 {{ site_name }}_{{ deployment_type }}:
61 type: tosca.nodes.SiteDeployment
Zack Williams682450e2016-11-19 09:04:41 -070062 requirements:
63 - site:
64 node: {{ site_name }}
Matteo Scandolo1ed76b82017-12-05 13:58:22 -080065 relationship: tosca.relationships.BelongsToOne
Zack Williams682450e2016-11-19 09:04:41 -070066 - deployment:
67 node: {{ deployment_type }}
Matteo Scandolo1ed76b82017-12-05 13:58:22 -080068 relationship: tosca.relationships.BelongsToOne
Zack Williams682450e2016-11-19 09:04:41 -070069
Zack Williamsa2763112017-01-03 11:38:38 -070070{% endif %}
Zack Williams682450e2016-11-19 09:04:41 -070071{% endfor %}
Zack Williams6ccbed22017-06-26 13:18:05 -070072{% endfor %}
Zack Williams682450e2016-11-19 09:04:41 -070073