1
0
mirror of https://github.com/krislamo/vagrant-easyredmine synced 2024-11-09 22:40:36 +00:00

add tasks to configure additional swapfile

This commit is contained in:
Mark Heiges 2016-10-10 13:09:40 -04:00
parent 5508e12f91
commit 88ad75b6f2
3 changed files with 48 additions and 0 deletions

View File

@ -31,6 +31,7 @@ smtp_username: smtpuser
smtp_password: smtppassword
smtp_authentication: plain
smtp_enable_starttls: true
swap_add_mb: 500
ruby_version: 2.1.3
is_production_vm: False
redmine_files_nfs_mount: '' # /mnt/redminefiles

View File

@ -0,0 +1,46 @@
# add new swap file if it does not already exist.
# Set `swap_add_mb` in config for swap size in MByte
# swap_add_mb: 1024
# Based on https://gist.github.com/manuelmeurer/a2c0a8c24a0bb5092250
#
- name: set swap_file variable
set_fact:
swap_file: /var/swap
- name: check if swap file exists
stat:
path: "{{ swap_file }}"
register: swap_file_check
- name: create swap file
become: yes
command: dd if=/dev/zero of="{{ swap_file }}" bs=1M count="{{ swap_add_mb }}"
when: not swap_file_check.stat.exists
- name: set permissions on swap file
become: yes
file:
path: "{{ swap_file }}"
mode: 0600
- name: format swap file
become: yes
command: mkswap {{ swap_file }}
when: not swap_file_check.stat.exists
- name: add to fstab
become: yes
lineinfile:
dest: /etc/fstab
regexp: "{{ swap_file }}"
line: "{{ swap_file }} none swap sw 0 0"
- name: turn on swap
become: yes
command: swapon -a
- name: set swapiness
become: yes
sysctl:
name: vm.swappiness
value: "1"

View File

@ -1,4 +1,5 @@
- include: addswap.yml
- name: install system tools
yum: name='{{ item }}'