28 lines
894 B
YAML
28 lines
894 B
YAML
---
|
|
|
|
- name: Check if cgroup memory and swapaccount in kernel
|
|
shell: grep GRUB_CMDLINE_LINUX_DEFAULT /etc/default/grub | grep -c "cgroup_enable=memory swapaccount=1"
|
|
register: cgroup_status
|
|
ignore_errors: true
|
|
|
|
- name: Enable cgroup memory and swapaccount
|
|
lineinfile: dest="/etc/default/grub" regexp='GRUB_CMDLINE_LINUX_DEFAULT="(.*)"' line='GRUB_CMDLINE_LINUX_DEFAULT="\1 cgroup_enable=memory swapaccount=1"' backrefs=yes
|
|
when: cgroup_status.stdout == "0"
|
|
|
|
- name: update-grub
|
|
shell: update-grub2
|
|
when: cgroup_status.stdout == "0"
|
|
|
|
- name: reboot if we need it
|
|
shell: sleep 2 && shutdown -r now "Ansible updates triggered"
|
|
async: 1
|
|
poll: 0
|
|
ignore_errors: true
|
|
when: cgroup_status.stdout == "0"
|
|
|
|
- name: waiting for server to come back
|
|
local_action: wait_for host={{ansible_fqdn}} state=started timeout=600 delay=15
|
|
sudo: false
|
|
when: cgroup_status.stdout == "0"
|
|
|