mac-setup/install/zip.yml

26 lines
1.1 KiB
YAML

---
- name: Download {{ app_name_pretty }}
get_url: url={{ app_url }} dest={{ downloads }}/{{ app_name }}.zip
- name: Check if application is already installed.
shell: "[ -f {{ creates }} ] && echo '1' || echo '0'"
changed_when: false
register: installed
- name: Create an extraction directory
file: path={{ downloads }}{{ app_name }}/ state=directory
when: "installed.stdout == '1'"
- name: Extract {{ app_name_pretty }} zip archive
command: unzip {{ app_name }}.zip -d {{ app_name }}/ chdir={{ downloads }} creates={{ creates }}
- name: Copy {{ app_name_pretty }} app to Applications directory
command: cp -R {{ app_name }}/{{ app_name }}.app /Applications chdir={{ downloads }} creates={{ creates }}
when: "installer_type == 'app'"
- name: Install {{ app_name_pretty }} pkg
command: sudo installer -package {{ app_name }}/{{ app_name }}.pkg -target {{ install_target }} chdir={{ downloads }} creates={{ creates }}
when: "installer_type == 'pkg'"
- name: Ensure extraction directory is gone
file: path={{ downloads }}{{ app_name }}/ state=absent