blob: 9fa6b0f60f285e074b8a249f9a7f4aac49aa8bf8 [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:
32 mgmt_ifname: "{{ (node.interfaces[idf.net_config.mgmt.interface].vlan == 'native') | ternary(interface.device, interface.device + '.' + node.interfaces[idf.net_config.mgmt.interface].vlan) }}"
33 loop: "{{ ansible_interfaces | map('regex_replace', '-', '_') | map('regex_replace', '^', 'ansible_') | map('extract', hostvars[inventory_hostname]) | selectattr('macaddress','defined') | list }}"
34 loop_control:
35 loop_var: interface
Vamsi Savaram5a7b9722019-09-20 11:16:46 +000036 when:
37 - interface.macaddress == node.interfaces[idf.net_config.mgmt.interface].mac_address
38 - "{{ '.' not in interface.device }}"
Vamsi Savaramf285ed82019-08-07 15:55:30 +000039
40- name: Fetch neutron network interface name
41 set_fact:
42 neutron_ifname: "{{ (node.interfaces[idf.net_config.neutron.interface].vlan == 'native') | ternary(interface.device, interface.device + '.' + node.interfaces[idf.net_config.neutron.interface].vlan) }}"
43 loop: "{{ ansible_interfaces | map('regex_replace', '-', '_') | map('regex_replace', '^', 'ansible_') | map('extract', hostvars[inventory_hostname]) | selectattr('macaddress','defined') | list }}"
44 loop_control:
45 loop_var: interface
Vamsi Savaram5a7b9722019-09-20 11:16:46 +000046 when:
47 - interface.macaddress == node.interfaces[idf.net_config.neutron.interface].mac_address
48 - "{{ '.' not in interface.device }}"