-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathkernelargs.yml
More file actions
135 lines (124 loc) · 4.88 KB
/
Copy pathkernelargs.yml
File metadata and controls
135 lines (124 loc) · 4.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# 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: Get the command line args of the node # noqa no-changed-when
ansible.builtin.command: cat /proc/cmdline
register: cmdline
- name: TSX KernelArgs compute node reboot prevention
when:
- '"nova_libvirt" in groups'
block:
- name: Check if node has a nova.conf
ansible.builtin.stat:
path: /var/lib/config-data/puppet-generated/nova_libvirt/etc/nova/nova.conf
register: nova_conf_check
- name: Enabling defer_reboot when TSX was added or appended
when:
- nova_conf_check.stat.exists
- tripleo_kernel_args is regex("^[\s]*tsx=[^\s]+[\s]*$")
block:
- name: Warn operator about workload protection
debug:
msg: |
Automated reboot for this node has been defered because it is already provisionned.
Please schedule a manual reboot after this deployment is completed.
- name: Setting defer reboot fact
ansible.builtin.set_fact:
tripleo_kernel_defer_reboot: true
tripleo_kernel_reboot_protection: true
- name: Check if the kernelargs entry is already present in the file
replace:
regexp: TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS
dest: /etc/default/grub
replace: ''
check_mode: true
register: grub_file_entry_check
# Kernel Args Configuration
- block:
# Leapp does not recognise grun entries starting other than GRUB
# It results wrong formatting of entries in file /etc/default/grub
# In order to fix it for FFU (queens to train), TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS has been renamed
# Ensure the fresh deployment is also alinged with the same name
- name: Delete older name TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS entries if present
ansible.builtin.lineinfile:
dest: /etc/default/grub
regexp: 'TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS'
state: absent
- name: Ensure the kernel args ( {{ tripleo_kernel_args }} ) is present as GRUB_TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS
ansible.builtin.lineinfile:
dest: /etc/default/grub
regexp: '^GRUB_TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS.*'
insertafter: '^GRUB_CMDLINE_LINUX.*'
line: 'GRUB_TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS=" {{ tripleo_kernel_args }} "'
- name: Add GRUB_TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS to the GRUB_CMDLINE_LINUX parameter
ansible.builtin.lineinfile:
dest: /etc/default/grub
line: 'GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX:+$GRUB_CMDLINE_LINUX }${GRUB_TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS}"'
insertafter: '^GRUB_TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS.*'
- name: Check grub config paths
ansible.builtin.stat:
path: "{{ item }}"
register: grub_stat
loop:
- /boot/efi/EFI/BOOT
- /boot/efi/EFI/redhat
- /boot/efi/EFI/centos
- /boot/efi/EFI/fedora
- name: Generate grub config
ansible.builtin.command: "grub2-mkconfig -o /boot/grub2/grub.cfg"
- name: Generate EFI grub config
ansible.builtin.command: "grub2-mkconfig -o {{ item.stat.path }}/grub.cfg"
when: item.stat.exists|bool
loop: "{{ grub_stat.results }}"
- name: Copy grubenv to EFI directory
ansible.builtin.copy:
remote_src: true
src: /boot/grub2/grubenv
dest: "{{ item.stat.path }}/grubenv"
mode: '600'
owner: root
group: root
when: item.stat.exists|bool
loop: "{{ grub_stat.results }}"
- name: Set reboot required fact
ansible.builtin.set_fact:
reboot_required: true
become: true
when:
- cmdline.stdout_lines is defined
- tripleo_kernel_args | default('', true) | length > 0
- tripleo_kernel_args not in cmdline.stdout
# Apply DPDK workarounds before reboot
- name: Apply DPDK workarounds
ansible.builtin.include_role:
name: tripleo_ovs_dpdk
tasks_from: workarounds.yml
when: reboot_required is defined and reboot_required
# Kernel modules loading
- name: Load type1 IOMMU driver for VFIO on boot
import_role:
name: tripleo_module_load
vars:
modules:
- name: vfio_iommu_type1
when: tripleo_kernel_args is search("iommu")
- name: Reboot block
when:
- reboot_required is defined and reboot_required
- not tripleo_kernel_defer_reboot|bool
- not tripleo_kernel_reboot_protection|bool
block:
- name: Reboot tasks
ansible.builtin.include_tasks: reboot.yaml