From c216bc7b60fdd4f7072d84bc315e4f1e8e60090c Mon Sep 17 00:00:00 2001 From: Markus Katharina Brechtel Date: Tue, 4 Aug 2020 05:53:30 +0200 Subject: [PATCH] fixes --- tasks/main.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 1b8c2c5..c676c17 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,19 +1,20 @@ --- - name: format - command: mkswap -U {{ item.uuid }} {{ item.device }} + command: mkswap {% if item.uuid is defined %}-U {{ item.uuid }}{% endif %} {{ item.device }} with_items: "{{ swap_devices }}" when: - swap_devices_state == "formated" + - swap_devices_state == "formated" + - item.format | default(true) - name: fstab for swap devices mount: name: none - src: UUID={{ item.uuid }} + src: "{% if item.uuid is defined %}UUID={{ item.uuid }}{% else %}{{ item.device }}{% endif %}" fstype: swap opts: sw - passno: 0 - dump: 0 + passno: '0' + dump: '0' state: present fstab: "{{ fstab_file }}" with_items: "{{ swap_devices }}"