run diskutil info only on Darwin kernels

This commit is contained in:
Jack Ivanov 2019-07-05 17:13:27 +02:00
parent dc727d45b4
commit cb8e196429

View file

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