Merge pull request #1058 from mrunalp/revert_swap

Revert "integration-playbook: Idempotent Swapping"
This commit is contained in:
Antonio Murdaca 2017-10-24 21:10:33 +02:00 committed by GitHub
commit e95f75e8f2
3 changed files with 7 additions and 47 deletions

View file

@ -1,42 +0,0 @@
---
- name: Obtain current state of swap
command: swapon --noheadings --show=NAME
register: swapon
- name: Setup swap if none already, to prevent kernel firing off the OOM killer
block:
- name: A unique swapfile path is generated
command: mktemp --tmpdir=/root swapfile_XXX
register: swapfilepath
- name: Swap file path is buffered
set_fact:
swapfilepath: '{{ swapfilepath.stdout | trim }}'
- name: Set swap file permissions
file:
path: "{{ swapfilepath }}"
owner: root
group: root
mode: 0600
- name: Swapfile padded to swapfile_size & timed to help debug any performance problems
shell: 'time dd if=/dev/zero of={{ swapfilepath }} bs={{ swapfileGB }}M count=1024'
- name: Swap file is formatted
command: 'mkswap {{ swapfilepath }}'
- name: Write swap entry in fstab
mount:
path: none
src: "{{ swapfilepath }}"
fstype: swap
opts: sw
state: present
- name: Mount swap
command: "swapon -a"
when: not (swapon.stdout_lines | length)

View file

@ -72,8 +72,13 @@
async: 600
poll: 10
- name: Check / setup swap
include: "swap.yml"
- name: Setup swap to prevent kernel firing off the OOM killer
shell: |
truncate -s 8G /root/swap && \
export SWAPDEV=$(losetup --show -f /root/swap | head -1) && \
mkswap $SWAPDEV && \
swapon $SWAPDEV && \
swapon --show
- name: ensure directories exist as needed
file:

View file

@ -1,8 +1,5 @@
---
# When swap setup is necessary, make it this size
swapfileGB: 8
# For results.yml Paths use rsync 'source' conventions
artifacts: "/tmp/artifacts" # Base-directory for collection
crio_integration_filepath: "{{ artifacts }}/testout.txt"