summaryrefslogtreecommitdiffstats
path: root/molecule/default/prepare.yml
blob: b9f84a7190df8748fbc8616cd2b0e96cf18d772f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
- name: Prepare
  hosts: localhost
  gather_facts: true
  tasks:
    - name: "Create virtual disk image"
      become: true
      community.general.filesize:
        path: "/opt/vdd.img"
        size: 12G
        mode: "0755"
        force: true

    - name: "Create test_device (loop block device)"
      become: true
      ansible.builtin.command:
        cmd: "losetup --show -Pf /opt/vdd.img"
      register: loop_device
      changed_when: true

    - name: "Set test facts"
      ansible.builtin.set_fact:
        test_device: "{{ loop_device.stdout }}"
        cacheable: true

    - name: "Show test info"
      ansible.builtin.debug:
        msg: "{{ item.name }}: {{ item.value }}"
      with_items:
        - name: "Test Device"
          value: "{{ test_device }}"