blob: 7301ba3efc86fd18829f2c80a3ed0fe8784c08e0 [file] [log] [blame]
Vamsi Savaramf285ed82019-08-07 15:55:30 +00001---
2# ============LICENSE_START=======================================================
3# Copyright (C) 2019 The Nordix Foundation. All rights reserved.
4# ================================================================================
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17# SPDX-License-Identifier: Apache-2.0
18# ============LICENSE_END=========================================================
19
Vamsi Savaramf285ed82019-08-07 15:55:30 +000020- name: Get node name from IDF for host "{{ inventory_hostname }}"
21 set_fact:
22 node_name: "{{ item.key }}"
23 with_dict: "{{ (installer_type == 'kolla') | ternary(idf.kolla.hostnames, idf.kubespray.hostnames) }}"
24 when: item.value == inventory_hostname
25
26- name: Set facts for the node "{{ node_name }}"
27 set_fact:
28 node: "{{ nodes | selectattr('name', 'equalto', node_name) | first }}"
29
30- name: Fetch mgmt network interface name
31 set_fact:
Fatih Degirmencidf251d52019-12-11 13:43:10 +010032 mgmt_ifname: |-
33 {{ (node.interfaces[idf.net_config.mgmt.interface].vlan == 'native') |
34 ternary(interface.device, interface.device + '.' + node.interfaces[idf.net_config.mgmt.interface].vlan) }}
35 loop: |-
36 {{ ansible_interfaces | map('regex_replace', '-', '_') | map('regex_replace', '^', 'ansible_') |
37 map('extract', hostvars[inventory_hostname]) | selectattr('macaddress','defined') | list }}
Vamsi Savaramf285ed82019-08-07 15:55:30 +000038 loop_control:
39 loop_var: interface
Vamsi Savaram5a7b9722019-09-20 11:16:46 +000040 when:
41 - interface.macaddress == node.interfaces[idf.net_config.mgmt.interface].mac_address
Fatih Degirmencidf251d52019-12-11 13:43:10 +010042 - "'.' not in interface.device"
Vamsi Savaramf285ed82019-08-07 15:55:30 +000043
44- name: Fetch neutron network interface name
45 set_fact:
Fatih Degirmencidf251d52019-12-11 13:43:10 +010046 neutron_ifname: |-
47 {{ (node.interfaces[idf.net_config.neutron.interface].vlan == 'native') |
48 ternary(interface.device, interface.device + '.' + node.interfaces[idf.net_config.neutron.interface].vlan) }}
49 loop: |-
50 {{ ansible_interfaces | map('regex_replace', '-', '_') | map('regex_replace', '^', 'ansible_') |
51 map('extract', hostvars[inventory_hostname]) | selectattr('macaddress','defined') | list }}
Vamsi Savaramf285ed82019-08-07 15:55:30 +000052 loop_control:
53 loop_var: interface
Vamsi Savaram5a7b9722019-09-20 11:16:46 +000054 when:
55 - interface.macaddress == node.interfaces[idf.net_config.neutron.interface].mac_address
Fatih Degirmencidf251d52019-12-11 13:43:10 +010056 - "'.' not in interface.device"
Fatih Degirmencief0b16f2020-01-08 23:53:05 +000057
58# vim: set ts=2 sw=2 expandtab: