blob: 35ed13d751d6bcda9c02e0484d48d9ce9cbae93d [file] [log] [blame]
---
# ============LICENSE_START=======================================================
# Copyright (C) 2019 The Nordix Foundation. All rights reserved.
# ================================================================================
# 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.
#
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
- name: Find node in PDF by node name '{{ host.key }}'
set_fact:
hostname: "{{ host.value }}"
node: "{{ nodes | selectattr('name', 'equalto', host.key) | first }}"
- name: Gather node data for '{{ hostname }}' from PDF and IDF
set_fact:
node_data:
name: "{{ hostname }}"
uuid: "{{ hostname | to_uuid }}"
host_groups: "{{ node_default_groups | union(host_roles[host.key]) }}"
driver: "{{ node.remote_management.type[0] }}"
driver_info:
power:
ipmi_address: "{{ node.remote_management.address }}"
ipmi_port: "{{ ( node.remote_management.port | default(623) | int ) }}"
ipmi_username: "{{ node.remote_management.user }}"
ipmi_password: "{{ node.remote_management.pass }}"
ipmi_priv_level: "{{ node.remote_management.privilege_level | default('ADMINISTRATOR') }}"
nics:
- mac: "{{ node.interfaces[idf.net_config[engine.pxe_network].interface].mac_address }}"
ansible_ssh_host: "{{ node.interfaces[idf.net_config[engine.pxe_network | default('admin')].interface].address }}"
ipv4_address: "{{ node.interfaces[idf.net_config[engine.pxe_network | default('admin')].interface].address }}"
properties:
cpu_arch: "{{ node.node.arch }}"
ram: "{{ ( node.node.memory.rstrip('G') | int ) * ( 1024 | int ) }}"
cpus: "{{ node.node.cpus }}"
disk_size: "{{ node.disks[0].disk_capacity.rstrip('G') }}"
- name: Add node data of '{{ hostname }}' to bifrost inventory
set_fact:
bifrost_inventory: "{{ bifrost_inventory | combine({hostname: node_data}) }}"
# vim: set ts=2 sw=2 expandtab: