Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Oefenweb/ansible-swapfile
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.37
Choose a base ref
...
head repository: Oefenweb/ansible-swapfile
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.0.38
Choose a head ref
  • 5 commits
  • 8 files changed
  • 1 contributor

Commits on Apr 21, 2023

  1. Consistency changes

    tersmitten committed Apr 21, 2023
    Copy the full SHA
    70bedf9 View commit details

Commits on Aug 30, 2023

  1. WIP

    tersmitten committed Aug 30, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    36e56ff View commit details
  2. WIP

    tersmitten committed Aug 30, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c786c1a View commit details
  3. WIP

    tersmitten committed Aug 30, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8fdba64 View commit details
  4. Merge pull request #19 from Oefenweb/consistency-changes

    Consistency changes
    tersmitten authored Aug 30, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    472d463 View commit details
Showing with 45 additions and 29 deletions.
  1. +2 −0 .ansible-lint
  2. +4 −5 .github/workflows/ci.yml
  3. +8 −5 Dockerfile
  4. +1 −1 meta/main.yml
  5. +6 −0 molecule/default/collections.yml
  6. +3 −1 molecule/default/molecule.yml
  7. +4 −0 requirements.yml
  8. +17 −17 tasks/main.yml
2 changes: 2 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
warn_list:
- role-name
- name[play]
- name[casing]
- no-handler
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -23,7 +23,9 @@ jobs:
python-version: '3.x'

- name: Install test dependencies
run: pip install ansible-lint[community,yamllint]
run: |
pip install ansible-lint
ansible-galaxy install -r requirements.yml
- name: Lint code
run: |
@@ -43,11 +45,8 @@ jobs:
matrix:
include:
- distro: debian8
ansible-version: '<2.10'
- distro: debian9
- distro: debian10
- distro: ubuntu1604
ansible-version: '>=2.9, <2.10'
- distro: ubuntu1604
ansible-version: '>=2.10, <2.11'
- distro: ubuntu1604
@@ -66,7 +65,7 @@ jobs:
python-version: '3.x'

- name: Install test dependencies
run: pip install 'ansible${{ matrix.ansible-version }}' molecule[docker] docker
run: pip install 'ansible${{ matrix.ansible-version }}' molecule-plugins[docker] docker

- name: Run Molecule tests
run: |
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
FROM ubuntu:16.04
FROM ubuntu:18.04
MAINTAINER Mischa ter Smitten <mtersmitten@oefenweb.nl>

ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

# python
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y python-minimal python-dev curl && \
DEBIAN_FRONTEND=noninteractive apt-get install -y python3-minimal python3-dev curl && \
apt-get clean
RUN curl -sL https://bootstrap.pypa.io/pip/2.7/get-pip.py | python -
RUN curl -sL https://bootstrap.pypa.io/pip/3.6/get-pip.py | python3 -
RUN rm -rf $HOME/.cache

# ansible
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y gcc libffi-dev libssl-dev && \
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python3-apt && \
apt-get clean
RUN pip install ansible==2.9.15
RUN pip3 install ansible==2.10.7
RUN rm -rf $HOME/.cache

# provision
2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ galaxy_info:
company: Oefenweb.nl B.V.
description: Manage a swap file in Debian-like systems
license: MIT
min_ansible_version: 2.9.0
min_ansible_version: 2.10.0
platforms:
- name: Ubuntu
versions:
6 changes: 6 additions & 0 deletions molecule/default/collections.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
collections:
- name: community.docker
version: '>=1.2.0,<2'
- name: community.general
version: '>=2,<3'
4 changes: 3 additions & 1 deletion molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -8,7 +8,9 @@ platforms:
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu1604}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
- /var/lib/containerd
cgroupns_mode: host
privileged: true
pre_build_image: true
provisioner:
4 changes: 4 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# requirements file
---
collections:
- name: ansible.posix
34 changes: 17 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
apt:
ansible.builtin.apt:
name: "{{ swapfile_dependencies }}"
state: "{{ apt_install_state | default('latest') }}"
update_cache: true
@@ -12,10 +12,14 @@
- swapfile-install
- swapfile-install-dependencies

- block:

- name: swap file
when: not swapfile_size | bool
tags:
- configuration
- swapfile
block:
- name: write swap file # noqa command-instead-of-module
command: >
ansible.builtin.command: >
fallocate -l {{ swapfile_size }} {{ swapfile_file }}
args:
creates: "{{ swapfile_file }}"
@@ -24,7 +28,7 @@
- swapfile-write-file

- name: set swap file permissions
file:
ansible.builtin.file:
path: "{{ swapfile_file }}"
owner: root
group: root
@@ -33,22 +37,24 @@
- swapfile-set-file-permissions

- name: create swap file # noqa command-instead-of-module
command: >
ansible.builtin.command: >
mkswap {{ swapfile_file }}
register: _create_swapfile
when: _write_swapfile.changed
changed_when: true
when: _write_swapfile is changed
tags:
- swapfile-mkswap

- name: enable swapfile # noqa command-instead-of-module
command: >
ansible.builtin.command: >
swapon {{ swapfile_file }}
changed_when: true
when: _create_swapfile is changed
tags:
- swapfile-enable-swapfile

- name: add swapfile to /etc/fstab
mount:
ansible.posix.mount:
name: none
src: "{{ swapfile_file }}"
fstype: swap
@@ -59,14 +65,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
sysctl:
ansible.posix.sysctl:
name: vm.swappiness
value: "{{ swapfile_swappiness | string }}"
reload: true
@@ -78,7 +78,7 @@
- swapfile-vm-swappiness

- name: configure vm.vfs_cache_pressure
sysctl:
ansible.posix.sysctl:
name: vm.vfs_cache_pressure
value: "{{ swapfile_vfs_cache_pressure | string }}"
reload: true