28 lines
681 B
YAML
28 lines
681 B
YAML
---
|
|
- name: Converge
|
|
hosts: all
|
|
|
|
pre_tasks:
|
|
|
|
- name: "Check if the disk file already exists"
|
|
register: mount_device_disk_file
|
|
ansible.builtin.stat:
|
|
path: /tmp/test_file
|
|
|
|
- name: "Create a file to act as a disk if it doesn't exist"
|
|
when: not mount_device_disk_file.stat.exists
|
|
changed_when: false
|
|
ansible.builtin.shell: |
|
|
dd if=/dev/zero of=/tmp/test_file bs=1000000 count=100
|
|
mkfs.ext3 /tmp/test_file
|
|
|
|
roles:
|
|
- role: genlab.common.mount_device
|
|
devices:
|
|
- what: "/tmp/test_file"
|
|
where: "/test_mount"
|
|
fstype: ext3
|
|
opts:
|
|
- noatime
|
|
state: mounted
|