summaryrefslogtreecommitdiffstats
path: root/roles/openshift_node
diff options
context:
space:
mode:
authorRussell Teague <rteague@redhat.com>2017-04-21 14:00:45 -0400
committerRussell Teague <rteague@redhat.com>2017-04-21 14:15:08 -0400
commit393acee29969ceaa676cc837654489f102f05cca (patch)
tree9f7c66bca1325e63d0db8f8833c46c0ad8dd5909 /roles/openshift_node
parent6497b5ae71d49e84b89e5763608f43e84aacab1e (diff)
downloadopenshift-393acee29969ceaa676cc837654489f102f05cca.tar.gz
openshift-393acee29969ceaa676cc837654489f102f05cca.tar.bz2
openshift-393acee29969ceaa676cc837654489f102f05cca.tar.xz
openshift-393acee29969ceaa676cc837654489f102f05cca.zip
Update swap disable tasks
* Lines are commented out vice being removed * Comment is added indicating why the change happened * Variable openshift_disable_swap added to allow user control
Diffstat (limited to 'roles/openshift_node')
-rw-r--r--roles/openshift_node/tasks/main.yml23
1 files changed, 14 insertions, 9 deletions
diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml
index 59003bbf9..98139cac2 100644
--- a/roles/openshift_node/tasks/main.yml
+++ b/roles/openshift_node/tasks/main.yml
@@ -38,28 +38,33 @@
- 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
+# Disable Swap Block
- block:
- name: Disable swap
command: swapoff --all
- name: Remove swap entries from /etc/fstab
+ replace:
+ dest: /etc/fstab
+ regexp: '(^[^#].*swap.*)'
+ replace: '# \1'
+ backup: yes
+
+ - name: Add notice about disabling swap
lineinfile:
dest: /etc/fstab
- regexp: 'swap'
- state: absent
+ line: '# OpenShift-Ansible Installer disabled swap per overcommit guidelines'
+ state: present
- when: swap_result.stdout_lines | length > 0
- # End Disable Swap Block
+ when:
+ - swap_result.stdout_lines | length > 0
+ - openshift_disable_swap | default(true)
+# 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.