summaryrefslogtreecommitdiff
path: root/roles/attach-loop-device/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/attach-loop-device/tasks/main.yml')
-rw-r--r--roles/attach-loop-device/tasks/main.yml12
1 files changed, 12 insertions, 0 deletions
diff --git a/roles/attach-loop-device/tasks/main.yml b/roles/attach-loop-device/tasks/main.yml
new file mode 100644
index 0000000..8815910
--- /dev/null
+++ b/roles/attach-loop-device/tasks/main.yml
@@ -0,0 +1,12 @@
+- name: Find the first unused loop device.
+ become: true
+ shell: losetup -f
+ register: result
+
+- name: Set up a loop device.
+ become: true
+ command: "losetup {{ result.stdout }} {{ vyos_raw_img }}"
+
+- name: Set vyos_target_drive.
+ set_fact:
+ vyos_target_drive: "{{ result.stdout }}"