Initial commit
[ta/infra-ansible.git] / roles / baremetal_provision / tasks / vbmc_port_setup.yml
diff --git a/roles/baremetal_provision/tasks/vbmc_port_setup.yml b/roles/baremetal_provision/tasks/vbmc_port_setup.yml
new file mode 100644 (file)
index 0000000..7061aa3
--- /dev/null
@@ -0,0 +1,42 @@
+---
+
+# Copyright 2019 Nokia
+
+# 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: Create a directory for virtualbmc.conf
+  file:
+    path: "/etc/virtualbmc/"
+    state: directory
+    mode: 0755
+
+- name: Copy in virtualbmc.conf file
+  copy:
+    src: "virtualbmc.conf"
+    dest: "/etc/virtualbmc/"
+
+- name: Create vbmc nodes
+  command: /usr/bin/vbmc add {{ item.name }} --libvirt-uri "qemu+ssh://root@{{item.driver_info['power']['ssh_address'] | ipwrap}}/system?no_verify=1" --port {{ item.driver_info['power']['ipmi_port'] }}
+  become: True
+  become_flags: '-H'
+  register: vbmc_out
+  with_items: "{{ baremetal_ironic_nodes }}"
+  failed_when: "vbmc_out.rc != 0 and 'already exists' not in vbmc_out.stderr"
+  loop_control:
+    label: "{{ item.name }}"
+
+- name: Start vbmc node ports
+  command: sudo /usr/bin/vbmc start {{ item.name }}
+  with_items: "{{ baremetal_ironic_nodes }}"
+  loop_control:
+    label: "{{ item.name }}"