Initial commit
[ta/infra-ansible.git] / roles / baremetal_provision / tasks / start_console_logging.yml
1 ---
2
3 # Copyright 2019 Nokia
4
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 - name: Deactivate ipmi sol
18   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"
19   with_items: "{{baremetal_ironic_nodes_ids}}"
20   ignore_errors: yes
21   no_log: True
22   loop_control:
23     label: "{{ item.name }}"
24
25 - name: Disable shellinabox console logging for target nodes
26   environment:
27     OS_AUTH_TOKEN: "fake-token"
28     IRONIC_URL: "{{ ironic_service_adminurl }}"
29   command: "ironic node-set-console-mode {{item.name}} false"
30   with_items: "{{ baremetal_ironic_nodes_ids }}"
31   when:
32     - installation_phase == "provisioning-started"
33   loop_control:
34     label: "{{ item.name }}"
35
36 - name: Disable shellinabox console logging for target nodes
37   command: "openstack --os-cloud default baremetal node console disable {{item.name}}"
38   with_items: "{{ baremetal_ironic_nodes_ids }}"
39   when:
40     - installation_phase != "provisioning-started"
41   loop_control:
42     label: "{{ item.name }}"
43
44 - name: Create directories for tmux
45   file:
46     path: "{{item}}"
47     state: directory
48     mode: u=rwx,g=rwx,o=rwx
49   with_items:
50     - "/var/log/ironic/console_logs"
51     - "/tmp/tmp_console"
52
53 - name: Start tmux console session
54   shell: "source /opt/tmux_setup/tmux.inc; tmux_session_start bash /bin/bash"
55
56 - name: Start tmux windows for each nodes
57   shell: "source /opt/tmux_setup/tmux.inc; tmux_cmd {{item.name}} /usr/bin/ipmitool -I lanplus -H {{hosts[item.name]['hwmgmt']['address']}} -U {{hosts[item.name]['hwmgmt']['user']}} -P {{hosts[item.name]['hwmgmt']['password']}} sol activate"
58   no_log: True
59   with_items: "{{baremetal_ironic_nodes_ids}}"
60   loop_control:
61     label: "{{ item.name }}"