Initial commit
[ta/infra-ansible.git] / roles / baremetal_provision / tasks / stop_console_logging.yml
diff --git a/roles/baremetal_provision/tasks/stop_console_logging.yml b/roles/baremetal_provision/tasks/stop_console_logging.yml
new file mode 100644 (file)
index 0000000..1e4cd35
--- /dev/null
@@ -0,0 +1,56 @@
+---
+
+# 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: Stop tmux console windows
+  shell: "source /opt/tmux_setup/tmux.inc; tmux_kill {{item.name}}"
+  with_items: "{{baremetal_ironic_nodes_ids}}"
+  ignore_errors: yes
+  loop_control:
+    label: "{{ item.name }}"
+
+
+- name: Stop tmux console session
+  shell: "source /opt/tmux_setup/tmux.inc; tmux_kill tmux-session-deploy"
+  ignore_errors: yes
+
+- name: Deactivate ipmi sol
+  command: "/usr/bin/ipmitool -I lanplus -H {{hosts[item.name]['hwmgmt']['address']}} -U {{hosts[item.name]['hwmgmt']['user']}} -P {{hosts[item.name]['hwmgmt']['password']}} sol deactivate"
+  with_items: "{{baremetal_ironic_nodes_ids}}"
+  ignore_errors: yes
+  no_log: True
+  loop_control:
+    label: "{{ item.name }}"
+
+- name: Enable shellinabox console logging for target nodes
+  environment:
+    OS_AUTH_TOKEN: "fake-token"
+    IRONIC_URL: "{{ ironic_service_adminurl }}"
+  command: "ironic node-set-console-mode {{item.name}} true"
+  with_items:
+    - "{{ baremetal_ironic_nodes_ids }}"
+    - {"name": "{{installation_controller}}"}
+  when:
+    - installation_phase == "provisioning-started"
+  loop_control:
+    label: "{{ item.name }}"
+
+- name: Enable shellinabox console logging for target nodes
+  command: "openstack --os-cloud default baremetal node console enable {{item.name}}"
+  with_items: "{{ baremetal_ironic_nodes_ids }}"
+  when:
+    - installation_phase != "provisioning-started"
+  loop_control:
+    label: "{{ item.name }}"