mac-setup/install/dmg.yml

24 lines
902 B
YAML

---
- name: Download {{ app_name_pretty }}
get_url: url={{ app_url }} dest={{ downloads }}/{{ app_name }}.dmg
- name: Mount {{ app_name_pretty }} image
command: hdiutil attach {{ app_name }}.dmg chdir={{ downloads }} creates={{ creates }}
- name: Copy {{ app_name_pretty }} app to Applications directory
command: cp -R {{ mount_path }}{{ app_name }}.app /Applications creates={{ creates }}
when: "installer_type == 'app'"
- name: Install {{ app_name_pretty }} pkg
command: installer -package {{ mount_path }}{{ app_name }}.pkg -target {{ install_target }} creates={{ creates }}
sudo: yes
when: "installer_type == 'pkg'"
- name: Check if image is mounted
shell: "[ -d {{ mount_path }} ] && echo '1' || echo '0'"
changed_when: false
register: mount_exists
- name: Unmount {{ app_name_pretty }} image
command: hdiutil detach {{ mount_path }}
when: "mount_exists.stdout == '1'"