Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
tersmitten committed Aug 30, 2023
1 parent 36e56ff commit c786c1a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
3 changes: 2 additions & 1 deletion requirements.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# requirements file
---
collections: []
collections:
- name: ansible.posix
33 changes: 16 additions & 17 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: install dependencies

Check warning on line 3 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
apt:
ansible.builtin.apt:
name: "{{ swapfile_dependencies }}"
state: "{{ apt_install_state | default('latest') }}"
update_cache: true
Expand All @@ -12,10 +12,15 @@
- swapfile-install
- swapfile-install-dependencies

- block:

- name: swap file

Check failure on line 15 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

literal-compare

Don't compare to literal True/False.

Check warning on line 15 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
# TODO: Changing this to `when: swapfile_size` seems to fail, find out why
when: swapfile_size != false
tags:
- configuration
- swapfile
block:
- name: write swap file # noqa command-instead-of-module

Check warning on line 22 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
command: >
ansible.builtin.command: >
fallocate -l {{ swapfile_size }} {{ swapfile_file }}
args:
creates: "{{ swapfile_file }}"
Expand All @@ -24,7 +29,7 @@
- swapfile-write-file

- name: set swap file permissions

Check warning on line 31 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
file:
ansible.builtin.file:
path: "{{ swapfile_file }}"
owner: root
group: root
Expand All @@ -33,22 +38,22 @@
- swapfile-set-file-permissions

- name: create swap file # noqa command-instead-of-module

Check warning on line 40 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check failure on line 40 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

no-changed-when

Commands should not change things if nothing needs doing.

Check failure on line 40 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

no-handler

Tasks that run when changed should likely be handlers.
command: >
ansible.builtin.command: >
mkswap {{ swapfile_file }}
register: _create_swapfile
when: _write_swapfile.changed
when: _write_swapfile is changed
tags:
- swapfile-mkswap

- name: enable swapfile # noqa command-instead-of-module

Check warning on line 48 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.

Check failure on line 48 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

no-changed-when

Commands should not change things if nothing needs doing.

Check failure on line 48 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

no-handler

Tasks that run when changed should likely be handlers.
command: >
ansible.builtin.command: >
swapon {{ swapfile_file }}
when: _create_swapfile is changed
tags:
- swapfile-enable-swapfile

- name: add swapfile to /etc/fstab

Check warning on line 55 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
mount:
ansible.posix.mount:
name: none
src: "{{ swapfile_file }}"
fstype: swap
Expand All @@ -59,14 +64,8 @@
tags:
- swapfile-fstab

# TODO: Changing this to `when: swapfile_size` seems to fail, find out why
when: swapfile_size != false
tags:
- configuration
- swapfile

- name: configure vm.swappiness

Check warning on line 67 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
sysctl:
ansible.posix.sysctl:
name: vm.swappiness
value: "{{ swapfile_swappiness | string }}"
reload: true
Expand All @@ -78,7 +77,7 @@
- swapfile-vm-swappiness

- name: configure vm.vfs_cache_pressure

Check warning on line 79 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Lint

name[casing]

All names should start with an uppercase letter.
sysctl:
ansible.posix.sysctl:
name: vm.vfs_cache_pressure
value: "{{ swapfile_vfs_cache_pressure | string }}"
reload: true
Expand Down

0 comments on commit c786c1a

Please sign in to comment.