Sha256: c62216ec23c30f596939789100be3a8b4749a6f1479a2221ced357035266ca15

Contents?: true

Size: 883 Bytes

Versions: 3

Compression:

Stored size: 883 Bytes

Contents

- name: Make zerod swap file
  command: dd if=/dev/zero of={{ swap_file.path }} bs=1024 count={{swap_file.size_kb}}
           creates={{ swap_file.path }}
- name: Set swap permissions
  file: path={{ swap_file.path }} owner=root group=root mode=0600

- name: Check swap type
  command: file {{ swap_file.path }}
  register: swapfile_info
  changed_when: swapfile_info.stdout.find('swap file') == -1

- name: mkswap on swap file
  command: mkswap {{ swap_file.path }}
  when: swapfile_info.stdout.find('swap file') == -1

- name: Put the swap entry into fstab
  mount: name=none src={{ swap_file.path }} fstype=swap opts=sw passno=0 dump=0 state=present

- name: Check swapon swapfile
  shell: swapon | grep "{{ swap_file.path }}"
  ignore_errors: True
  register: swap_file_is_on

- name: Swapon swapfile
  command: swapon {{ swap_file.path }}
  when: swap_file_is_on.stdout == ""

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
taperole-2.1.1 roles/general/tasks/swapfile.yml
taperole-2.1.0 roles/general/tasks/swapfile.yml
taperole-2.0.7 roles/general/tasks/swapfile.yml