Small refactoring
diff --git a/baremetal_simulator/init.sls b/baremetal_simulator/init.sls
index 62f2051..ec8abbe 100644
--- a/baremetal_simulator/init.sls
+++ b/baremetal_simulator/init.sls
@@ -1,4 +1,4 @@
-{%- from "baremetal_simulator/map.jinja" import baremetal_simulator with context %}
+{%- from "baremetal_simulator/map.jinja" import baremetal_simulator,bs_nodes with context %}
{%- if baremetal_simulator.enabled %}
simulator_pkgs:
@@ -52,7 +52,7 @@
{%- endif %}
-{%- for identity_name, nodes in baremetal_simulator.nodes.iteritems() %}
+{%- for identity_name, nodes in bs_nodes.iteritems() %}
{%- for node in nodes %}
disk_create_node{{ loop.index }}:
@@ -83,14 +83,6 @@
- name: vbmc start {{ node.name }} > /dev/null 2>&1 && sleep 1
- unless: vbmc show {{ node.name }} | grep status |grep -q running
-node_{{ node.name }}_present:
- ironicng.node_present:
- - name: {{ node.name }}
- - driver: {{ node.driver }}
- - properties: {{ node.properties }}
- - profile: {{ identity_name }}
- - driver_info: {{ node.driver_info }}
-
{%- for port in node.ports %}
{{ node.name }}_tap_device_{{ loop.index }}:
@@ -103,11 +95,6 @@
- name: tap-{{ node.name }}i{{ loop.index }}
- bridge: br-simulator
-{{ node.name }}_port{{ loop.index }}_present:
- ironicng.port_present:
- - address: {{ port.address }}
- - node_name: {{ node.name }}
- - profile: {{ identity_name }}
{%- endfor %}
{%- endfor %}
diff --git a/baremetal_simulator/map.jinja b/baremetal_simulator/map.jinja
index 79f1427..1ef3600 100644
--- a/baremetal_simulator/map.jinja
+++ b/baremetal_simulator/map.jinja
@@ -1,6 +1,8 @@
{% set baremetal_simulator = salt['grains.filter_by']({
'Common': {
'pkgs': ['python-pip', 'openvswitch-switch', 'libvirt-bin'],
- 'pip_pkgs': ['virtualbmc']
+ 'pip_pkgs': ['virtualbmc'],
}
}, base='Common', merge=pillar.get('baremetal_simulator', {})) %}
+
+{%- set bs_nodes = pillar.get('ironic', {}).get('client', {}).get('nodes', {}) %}