Fatih Degirmenci | 50b146b | 2019-05-10 14:11:57 +0200 | [diff] [blame] | 1 | --- |
| 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========================================================= |
Fatih Degirmenci | ef0b16f | 2020-01-08 23:53:05 +0000 | [diff] [blame^] | 19 | |
Fatih Degirmenci | 50b146b | 2019-05-10 14:11:57 +0200 | [diff] [blame] | 20 | - name: Find node in PDF by node name '{{ host.key }}' |
| 21 | set_fact: |
| 22 | hostname: "{{ host.value }}" |
| 23 | node: "{{ nodes | selectattr('name', 'equalto', host.key) | first }}" |
| 24 | |
| 25 | - name: Gather node data for '{{ hostname }}' from PDF and IDF |
| 26 | set_fact: |
| 27 | node_data: |
| 28 | name: "{{ hostname }}" |
| 29 | uuid: "{{ hostname | to_uuid }}" |
| 30 | host_groups: "{{ node_default_groups | union(host_roles[host.key]) }}" |
| 31 | driver: "{{ node.remote_management.type[0] }}" |
| 32 | driver_info: |
| 33 | power: |
| 34 | ipmi_address: "{{ node.remote_management.address }}" |
| 35 | ipmi_port: "{{ ( node.remote_management.port | default(623) | int ) }}" |
| 36 | ipmi_username: "{{ node.remote_management.user }}" |
| 37 | ipmi_password: "{{ node.remote_management.pass }}" |
| 38 | ipmi_priv_level: "{{ node.remote_management.privilege_level | default('ADMINISTRATOR') }}" |
| 39 | |
| 40 | nics: |
| 41 | - mac: "{{ node.interfaces[idf.net_config[engine.pxe_network].interface].mac_address }}" |
| 42 | ansible_ssh_host: "{{ node.interfaces[idf.net_config[engine.pxe_network | default('admin')].interface].address }}" |
| 43 | ipv4_address: "{{ node.interfaces[idf.net_config[engine.pxe_network | default('admin')].interface].address }}" |
| 44 | properties: |
| 45 | cpu_arch: "{{ node.node.arch }}" |
| 46 | ram: "{{ ( node.node.memory.rstrip('G') | int ) * ( 1024 | int ) }}" |
| 47 | cpus: "{{ node.node.cpus }}" |
| 48 | disk_size: "{{ node.disks[0].disk_capacity.rstrip('G') }}" |
| 49 | |
| 50 | - name: Add node data of '{{ hostname }}' to bifrost inventory |
| 51 | set_fact: |
| 52 | bifrost_inventory: "{{ bifrost_inventory | combine({hostname: node_data}) }}" |
Fatih Degirmenci | ef0b16f | 2020-01-08 23:53:05 +0000 | [diff] [blame^] | 53 | |
| 54 | # vim: set ts=2 sw=2 expandtab: |