[ATMOSPHERE-309] Add Ironic (#1712)
This is an automated cherry-pick of #1697
/assign mnaser
diff --git a/roles/ironic/tasks/network/lookup.yml b/roles/ironic/tasks/network/lookup.yml
new file mode 100644
index 0000000..8838ac9
--- /dev/null
+++ b/roles/ironic/tasks/network/lookup.yml
@@ -0,0 +1,33 @@
+# Copyright (c) 2022 VEXXHOST, Inc.
+#
+# 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.
+
+- name: Gather information about a bare metal network
+ run_once: true
+ openstack.cloud.networks_info:
+ cloud: atmosphere
+ # Network settings
+ name: "{{ ironic_bare_metal_network_name }}"
+ register: ironic_bare_metal_networks_info
+
+- name: Assert that we match a single network only
+ ansible.builtin.assert:
+ that:
+ - ironic_bare_metal_networks_info.openstack_networks | length == 1
+ fail_msg: "Expected exactly one network, but found {{ ironic_bare_metal_networks_info.openstack_networks | length }}"
+ success_msg: "Successfully matched a single network"
+ run_once: true
+
+- name: Set fact with bare metal network information
+ ansible.builtin.set_fact:
+ ironic_bare_metal_network: "{{ ironic_bare_metal_networks_info.openstack_networks[0] }}"