Git Product home page Git Product logo

ansible-swap's Introduction

About

Ansible role ansible-swap Install, setup and run zSwap and zRAM as systemd service for VM and BareMetal servers.

Requirements

  • systemd

Role variables

Defaults

---
# defaults file for ansible-swap
dpkg_force_overwrite_configs: false

# swapfile
swap_file_enabled: false
# Use any of the following suffixes
# c=1
# w=2
# b=512
# kB=1000
# K=1024
# MB=1000*1000
# M=1024*1024
# xM=M
# GB=1000*1000*1000
# G=1024*1024*1024
swap_file_path: '/swapfile'
swap_file_size: '2G'


# systemd-swap
swap_systemd_enabled: true
swap_systemd_package:
  name: 'systemd-swap'
  version: '4.0.2'
  deb: 'systemd-swap_4.0.2_all.deb'

# zSwap
swap_systemd_zswap_enabled: false
swap_systemd_zswap_max_pool_percent: 20

# zRam
swap_systemd_zram_enabled: false
# swap_systemd_zram_size: "{{ (( ansible_memtotal_mb * 1024 * 1024 | filesizeformat | human_to_bytes ) / 2 ) | int | abs }}" # in bytes
# swap_systemd_zram_count: "{{ ( ansible_processor_vcpus / 2 ) | int | abs }}"
# swap_systemd_zram_streams: "{{ ansible_processor_vcpus }}"
swap_systemd_zram_size: '$(( ${RAM_SIZE} / 2 ))'
swap_systemd_zram_count: '${NCPU}'
swap_systemd_zram_streams: '${NCPU}'

# Swap File Chunks
swap_systemd_swapfc_enabled: false
swap_systemd_swapfc_force_use_loop: true
swap_systemd_swapfc_chunk_size: '512M'
swap_systemd_swapfc_max_count: 8 # 1..32
swap_systemd_swapfc_free_swap_perc: 15

# Swap Device
swap_systemd_swapd_auto_swapon: true

Dependencies

Example playbook

- hosts: servers
  roles:
    - role: ansible-swap

License

MIT

ansible-swap's People

Contributors

crrlcx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.