- diskutil to full path
- unmount and eject fixes
This commit is contained in:
Jack Ivanov 2019-07-05 11:59:38 +02:00
parent d4661a1aa0
commit 6ce16e8079
2 changed files with 19 additions and 5 deletions

View file

@ -6,7 +6,7 @@
- name: MacOS | mount a ram disk
shell:
diskutil info "/{{ tmpfs_volume_path }}/{{ tmpfs_volume_name }}/" ||
diskutil erasevolume HFS+ "{{ tmpfs_volume_name }}" $(hdiutil attach -nomount ram://64000)
/usr/sbin/diskutil info "/{{ tmpfs_volume_path }}/{{ tmpfs_volume_name }}/" ||
/usr/sbin/diskutil erasevolume HFS+ "{{ tmpfs_volume_name }}" $(hdiutil attach -nomount ram://64000)
args:
creates: "/{{ tmpfs_volume_path }}/{{ tmpfs_volume_name }}"

View file

@ -5,7 +5,21 @@
state: absent
when: facts.ansible_system == "Linux"
- name: MacOS | eject the ram disk
command: diskutil eject "/{{ facts.tmpfs_volume_path }}/{{ facts.tmpfs_volume_name }}/" || true
- name: MacOS | check fs the ramdisk exists
command: /usr/sbin/diskutil info AlgoVPN-test
ignore_errors: true
changed_when: false
when: facts.ansible_system == "Darwin"
register: diskutil_info
- name: MacOS | unmount and eject the ram disk
shell:
/usr/sbin/diskutil umount force "/{{ facts.tmpfs_volume_path }}/{{ facts.tmpfs_volume_name }}/" &&
/usr/sbin/diskutil eject "{{ facts.tmpfs_volume_name }}"
changed_when: false
when:
- facts.ansible_system == "Darwin"
- diskutil_info.rc == 0
register: result
until: result.rc == 0
retries: 5
delay: 3