Skip to content
Snippets Groups Projects
Unverified Commit 2e8b72e2 authored by Kay Yan's avatar Kay Yan Committed by GitHub
Browse files

fix disable swap in centos (#10751)

parent ddf5c6ee
No related branches found
No related tags found
No related merge requests found
---
- name: Check if /etc/fstab exists
stat:
path: "/etc/fstab"
get_attributes: no
get_checksum: no
get_mime: no
register: fstab_file
- name: Remove swapfile from /etc/fstab
ansible.posix.mount:
name: "{{ item }}"
fstype: swap
state: absent
loop:
- swap
- none
when: fstab_file.stat.exists
- name: Mask swap.target (persist swapoff)
ansible.builtin.systemd_service:
name: swap.target
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment