diff --git a/tasks/default.yml b/tasks/default.yml new file mode 100644 index 0000000..3ae781d --- /dev/null +++ b/tasks/default.yml @@ -0,0 +1 @@ +fstab_file: "{{ root_target_directory | default('') }}/etc/fstab" diff --git a/tasks/main.yml b/tasks/main.yml index ff3a5bb..1b8c2c5 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,6 +1,12 @@ --- +--- -- name: swap +- name: format + command: mkswap -U {{ item.uuid }} {{ item.device }} + with_items: "{{ swap_devices }}" + when: + swap_devices_state == "formated" + +- name: fstab for swap devices mount: name: none src: UUID={{ item.uuid }} @@ -9,4 +15,7 @@ passno: 0 dump: 0 state: present + fstab: "{{ fstab_file }}" with_items: "{{ swap_devices }}" + when: + swap_devices_state == "configured"