summaryrefslogtreecommitdiffstats
path: root/roles/openshift_node_upgrade
diff options
context:
space:
mode:
authorOpenShift Bot <eparis+openshiftbot@redhat.com>2017-04-13 13:47:27 -0500
committerGitHub <noreply@github.com>2017-04-13 13:47:27 -0500
commit6591b6f762b64e2f0677e8fb7178d2a5f7f07609 (patch)
tree7cc72c6c3c93809dbd187042ad9cc8581f87998f /roles/openshift_node_upgrade
parenta63467ae26422433d6a095d7d2e1babd9fd6a449 (diff)
parent38e0c9c84f8fae385fa68fd90b285d448ba24a1e (diff)
downloadopenshift-6591b6f762b64e2f0677e8fb7178d2a5f7f07609.tar.gz
openshift-6591b6f762b64e2f0677e8fb7178d2a5f7f07609.tar.bz2
openshift-6591b6f762b64e2f0677e8fb7178d2a5f7f07609.tar.xz
openshift-6591b6f762b64e2f0677e8fb7178d2a5f7f07609.zip
Merge pull request #3884 from mtnbikenc/disable-swap
Merged by openshift-bot
Diffstat (limited to 'roles/openshift_node_upgrade')
-rw-r--r--roles/openshift_node_upgrade/tasks/main.yml27
1 files changed, 27 insertions, 0 deletions
diff --git a/roles/openshift_node_upgrade/tasks/main.yml b/roles/openshift_node_upgrade/tasks/main.yml
index 6ae8dbc12..01bd3bf38 100644
--- a/roles/openshift_node_upgrade/tasks/main.yml
+++ b/roles/openshift_node_upgrade/tasks/main.yml
@@ -84,6 +84,33 @@
value: "{{ oreg_url }}"
when: oreg_url is defined
+# 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
+
- name: Restart rpm node service
service:
name: "{{ openshift.common.service_type }}-node"