diff options
author | Russell Teague <rteague@redhat.com> | 2017-04-07 11:20:19 -0400 |
---|---|---|
committer | Russell Teague <rteague@redhat.com> | 2017-04-12 15:34:42 -0400 |
commit | 38e0c9c84f8fae385fa68fd90b285d448ba24a1e (patch) | |
tree | 778c320b5c1c106ca2ba0cbe8094811faa5a4429 /roles/openshift_node | |
parent | 2942b0327520c458230501678c5ff877bc038f0d (diff) | |
download | openshift-38e0c9c84f8fae385fa68fd90b285d448ba24a1e.tar.gz openshift-38e0c9c84f8fae385fa68fd90b285d448ba24a1e.tar.bz2 openshift-38e0c9c84f8fae385fa68fd90b285d448ba24a1e.tar.xz openshift-38e0c9c84f8fae385fa68fd90b285d448ba24a1e.zip |
Disable swap space on nodes at install and upgrade
Diffstat (limited to 'roles/openshift_node')
-rw-r--r-- | roles/openshift_node/tasks/main.yml | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml index 626248306..59003bbf9 100644 --- a/roles/openshift_node/tasks/main.yml +++ b/roles/openshift_node/tasks/main.yml @@ -34,6 +34,33 @@ dns_ip: "{{ openshift_dns_ip | default(none) | get_dns_ip(hostvars[inventory_hostname])}}" env_vars: "{{ openshift_node_env_vars | default(None) }}" +# https://docs.openshift.com/container-platform/3.4/admin_guide/overcommit.html#disabling-swap-memory +- name: Check for swap usage + command: grep "^[^#].*swap" /etc/fstab + # grep: match any lines which don't begin with '#' and contain 'swap' + # command: swapon --summary + # Alternate option, however if swap entries are in fstab, swap will be + # enabled at boot. Grepping fstab should catch a condition when swap was + # disabled, but the fstab entries were not removed. + changed_when: false + failed_when: false + register: swap_result + + # Disable Swap Block +- block: + + - name: Disable swap + command: swapoff --all + + - name: Remove swap entries from /etc/fstab + lineinfile: + dest: /etc/fstab + regexp: 'swap' + state: absent + + when: swap_result.stdout_lines | length > 0 + # End Disable Swap Block + # We have to add tuned-profiles in the same transaction otherwise we run into depsolving # problems because the rpms don't pin the version properly. This was fixed in 3.1 packaging. - name: Install Node package |