Execution
Date 03 Jun 2024 14:35:54 +0100
Duration 00:00:49.18
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.4
ara 1.7.1 / 1.7.1
Python 3.10.10
Summary
81 Hosts
4 Tasks
324 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/check-swap.yaml

---
- name: Check swap size
  hosts: all
  tasks:
    - name: Get swap size
      command: "swapon --show=SIZE --noheadings --bytes"
      register: swap_output

    - name: Sum swap size
      set_fact:
        total_swap_size: "{{ swap_output.stdout_lines | map('int') | sum }}"

    - name: Check if swap size is 1G
      debug:
        msg: "Swap size is 1G"
      when: total_swap_size == 1073741824