blob: 95a8f71f524f99d462f07c1d0519a1aa3abde31e [file] [log] [blame]
Mohammed Naser298f0272024-07-29 18:43:25 -04001# Copyright (c) 2022 VEXXHOST, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15- name: Gather information about a bare metal network
16 run_once: true
17 openstack.cloud.networks_info:
18 cloud: atmosphere
19 # Network settings
20 name: "{{ ironic_bare_metal_network_name }}"
21 register: ironic_bare_metal_networks_info
22
23- name: Assert that we match a single network only
24 ansible.builtin.assert:
25 that:
Mohammed Naser8ccabb62025-02-05 13:20:09 -050026 - ironic_bare_metal_networks_info.networks | length == 1
27 fail_msg: "Expected exactly one network, but found {{ ironic_bare_metal_networks_info.networks | length }}"
Mohammed Naser298f0272024-07-29 18:43:25 -040028 success_msg: "Successfully matched a single network"
29 run_once: true
30
31- name: Set fact with bare metal network information
32 ansible.builtin.set_fact:
Mohammed Naser8ccabb62025-02-05 13:20:09 -050033 ironic_bare_metal_network: "{{ ironic_bare_metal_networks_info.networks[0] }}"