unified_cgroup_hierarchy.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. - name: Check if systemd.unified_cgroup_hierarchy=0 is in /proc/cmdline
  2. shell: "grep 'systemd.unified_cgroup_hierarchy=0' /proc/cmdline"
  3. register: unified_cgroup_hierarchy
  4. ignore_errors: true
  5. failed_when: false
  6. - debug: var=unified_cgroup_hierarchy.rc
  7. - debug: var=unified_cgroup_hierarchy.stdout
  8. - block:
  9. - name: Append systemd.unified_cgroup_hierarchy=0 to GRUB_CMDLINE_LINUX
  10. shell: |
  11. GRUB_FILE="/etc/default/grub"
  12. SEARCH_PATTERN="^GRUB_CMDLINE_LINUX="
  13. APPEND_TEXT="systemd.unified_cgroup_hierarchy=0 "
  14. if ! grep -q "systemd.unified_cgroup_hierarchy=0" "$GRUB_FILE"; then
  15. sed -i.bak.$(date +%Y%m%d-%H%M%S) "/$SEARCH_PATTERN/s/\"/& $APPEND_TEXT/" "$GRUB_FILE"
  16. fi
  17. args:
  18. executable: /bin/bash
  19. register: grub_update
  20. - name: Update GRUB
  21. command: update-grub
  22. - name: Check is need manual reboot to disable unified cgroup hierarchy
  23. fail:
  24. msg: "GRUB updated, Please reboot to disable cgroup hierarchy and run install script again"
  25. when: is_controller_node|default(false)|bool == true
  26. - name: Reboot the system
  27. reboot:
  28. reboot_timeout: 600
  29. async: 30
  30. poll: 0
  31. ignore_errors: true
  32. - name: Wait for the system to come back online
  33. become: yes
  34. wait_for_connection:
  35. delay: 15
  36. timeout: 600
  37. vars:
  38. ansible_connection: smart
  39. ansible_ssh_host: "{{ ansible_host }}" #
  40. when:
  41. - unified_cgroup_hierarchy.rc != 0