TripleO Ansible project repository. Contains playbooks for use with TripleO OpenStack deployments.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

77 lines
2.6 KiB

  1. ---
  2. # Copyright 2019 Red Hat, Inc.
  3. # All Rights Reserved.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  6. # not use this file except in compliance with the License. You may obtain
  7. # 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, WITHOUT
  13. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14. # License for the specific language governing permissions and limitations
  15. # under the License.
  16. - name: Get the command line args of the node
  17. command: cat /proc/cmdline
  18. register: cmdline
  19. # Kernel Args Configuration
  20. - block:
  21. - name: Ensure the kernel args ( {{ tripleo_kernel_args }} ) is present as TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS
  22. lineinfile:
  23. dest: /etc/default/grub
  24. regexp: '^TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS.*'
  25. insertafter: '^GRUB_CMDLINE_LINUX.*'
  26. line: 'TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS=" {{ tripleo_kernel_args }} "'
  27. - name: Add TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS to the GRUB_CMDLINE_LINUX parameter
  28. lineinfile:
  29. dest: /etc/default/grub
  30. line: 'GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX:+$GRUB_CMDLINE_LINUX }${TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS}"'
  31. insertafter: '^TRIPLEO_HEAT_TEMPLATE_KERNEL_ARGS.*'
  32. - name: Check grub config paths
  33. stat:
  34. path: "{{ item }}"
  35. register: grub_stat
  36. loop:
  37. - /boot/grub2/grub.cfg
  38. - /boot/efi/EFI/redhat/grub.cfg
  39. - /boot/efi/EFI/centos/grub.cfg
  40. - /boot/efi/EFI/fedora/grub.cfg
  41. - name: Generate grub config
  42. command: "grub2-mkconfig -o {{ item.stat.path }}"
  43. when: item.stat.exists|bool
  44. loop: "{{ grub_stat.results }}"
  45. - name: Set reboot required fact
  46. set_fact:
  47. reboot_required: true
  48. become: true
  49. when:
  50. - cmdline.stdout_lines is defined
  51. - tripleo_kernel_args|string
  52. - tripleo_kernel_args not in cmdline.stdout_lines[0]
  53. # Apply DPDK workarounds before reboot
  54. - name: Apply DPDK workarounds
  55. include_role:
  56. name: tripleo_ovs_dpdk
  57. tasks_from: workarounds.yml
  58. when: reboot_required is defined and reboot_required
  59. # Kernel modules loading
  60. - name: Load type1 IOMMU driver for VFIO on boot
  61. import_role:
  62. name: tripleo_module_load
  63. vars:
  64. modules:
  65. - name: vfio_iommu_type1
  66. when: tripleo_kernel_args is search("iommu")
  67. - name: Reboot and workaround block
  68. include_tasks: reboot.yaml
  69. when:
  70. - reboot_required is defined and reboot_required
  71. - not tripleo_kernel_defer_reboot|bool