diff options
author | OpenShift Bot <eparis+openshiftbot@redhat.com> | 2017-04-25 00:08:16 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-25 00:08:16 -0500 |
commit | 9a2770bdafcb3df6863ff132e0a7e5b4c48a1a24 (patch) | |
tree | 6a7fe832092f823f04751ecc3f0818cd6dbc66c3 /roles | |
parent | db492e0e8458006c8b2f67025198b8456ee88a84 (diff) | |
parent | 393acee29969ceaa676cc837654489f102f05cca (diff) | |
download | openshift-9a2770bdafcb3df6863ff132e0a7e5b4c48a1a24.tar.gz openshift-9a2770bdafcb3df6863ff132e0a7e5b4c48a1a24.tar.bz2 openshift-9a2770bdafcb3df6863ff132e0a7e5b4c48a1a24.tar.xz openshift-9a2770bdafcb3df6863ff132e0a7e5b4c48a1a24.zip |
Merge pull request #3976 from mtnbikenc/swap-update
Merged by openshift-bot
Diffstat (limited to 'roles')
-rw-r--r-- | roles/openshift_node/tasks/main.yml | 23 | ||||
-rw-r--r-- | roles/openshift_node_upgrade/tasks/main.yml | 19 |
2 files changed, 26 insertions, 16 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. diff --git a/roles/openshift_node_upgrade/tasks/main.yml b/roles/openshift_node_upgrade/tasks/main.yml index 57da86620..e725f4a5d 100644 --- a/roles/openshift_node_upgrade/tasks/main.yml +++ b/roles/openshift_node_upgrade/tasks/main.yml @@ -99,10 +99,6 @@ - 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 @@ -114,12 +110,21 @@ 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 + when: + - swap_result.stdout_lines | length > 0 + - openshift_disable_swap | default(true) # End Disable Swap Block # Restart all services |