Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions playbooks/run-swapspace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env -S ansible-playbook -e @vars/extra.yaml
#
# Playbook to install and run Swapspace package for dynamic swap managed
#
# > ./run-swapspace.yml
---
- name: Install Swapspace
hosts: swap_hosts
remote_user: root
tasks:
- name: Swapspace | Clone repo
git:
repo: https://github.com/Tookmund/Swapspace.git
dest: /opt/Swapspace
clone: yes

- name: Swapspace | Ensure required packages are installed
apt:
update_cache: yes
name: autoconf
state: present

- name: Swapspace | Set up conf for Swapspace
command:
cmd: "autoreconf -i"
chdir: "/opt/Swapspace/"

- name: Swapspace | Build swapspace package
shell:
cmd: "./configure && make && make install"
chdir: "/opt/Swapspace/"

- name: Swapspace | Clean temporary files
shell:
cmd: "make clean & make distclean"
chdir: "/opt/Swapspace/"

- name: Swapspace | Move swapspace.service to systemd
copy:
remote_src: true
src: "/opt/Swapspace/swapspace.service"
dest: "/etc/systemd/system/swapspace.service"

- name: Swapspace | Reload systemd
systemd:
daemon_reload: true

- name: Swapspace | Enable Swapspace
systemd:
name: swapspace.service
enabled: true
state: started