Skip to content

Commit

Permalink
Don't create swap if swap is already there
Browse files Browse the repository at this point in the history
  • Loading branch information
Dejan Menges committed May 18, 2021
1 parent 5e24f00 commit efcf1d8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions roles/third_party/linux/swap-setup/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
- name: Check if swap is already configured on the server
shell: /usr/bin/cat /proc/swaps | grep -v Filename
#changed_when: true
register: swap_is_already_configured
ignore_errors: true

- name: Verify if swap is already configured by Ansible
stat:
path: "{{ __swapfile_success }}"
Expand All @@ -7,3 +13,4 @@
include_tasks: configure_swap.yml
when:
- not swap_configured_by_ansible.stat.exists
- swap_is_already_configured.rc != 0

0 comments on commit efcf1d8

Please sign in to comment.