diff --git a/install/app.yaml b/install/app.yaml index 3dda181..d473493 100644 --- a/install/app.yaml +++ b/install/app.yaml @@ -1,3 +1,5 @@ --- +- name: Remove existing app if present + file: path=/Applications/$app_name.app state=absent - name: Copy $app_name_pretty app to Applications directory command: cp -R $app_name.app /Applications chdir=$downloads \ No newline at end of file diff --git a/install/dmg.yaml b/install/dmg.yaml index c9ea681..d1ee919 100644 --- a/install/dmg.yaml +++ b/install/dmg.yaml @@ -3,11 +3,14 @@ get_url: url=$app_url dest=$downloads/$app_name.dmg - name: Mount $app_name_pretty image command: hdiutil attach $app_name.dmg chdir=$downloads +- name: Remove existing app if present + file: path=/Applications/$app_name.app state=absent + when_string: $installer_type == 'app' - name: Copy $app_name_pretty app to Applications directory - command: cp -R ${mount_path}$app_name.app /Applications + command: cp -R $mount_path$app_name.app /Applications when_string: $installer_type == 'app' - name: Install $app_name pkg - command: sudo installer -package ${mount_path}$app_name.pkg -target $install_target + command: sudo installer -package $mount_path$app_name.pkg -target $install_target when_string: $installer_type == 'pkg' - name: Unmount $app_name_pretty image command: hdiutil detach $mount_path \ No newline at end of file diff --git a/install/pkg.yaml b/install/pkg.yaml index b0420d8..20ad179 100644 --- a/install/pkg.yaml +++ b/install/pkg.yaml @@ -1,2 +1,3 @@ +--- - name: Install $app_name pkg command: sudo installer -package $app_name.pkg -target $install_target \ No newline at end of file diff --git a/install/tar.yaml b/install/tar.yaml index 2180631..530920b 100644 --- a/install/tar.yaml +++ b/install/tar.yaml @@ -1,10 +1,15 @@ --- - name: Download $app_name_pretty - get_url: url=$app_url dest=${downloads}/$app_name.tar + get_url: url=$app_url dest=$downloads/$app_name.tar +- name: Remove existing extraction directory if present + file: path=$downloads$app_name/ state=absent - name: Create an extraction directory - file: path=${downloads}${app_name}/ state=directory + file: path=$downloads$app_name/ state=directory - name: Extract $app_name_pretty tarball command: tar xf $app_name.tar -C $app_name/ chdir=$downloads +- name: Remove existing app if present + file: path=/Applications/$app_name.app state=absent + when_string: $installer_type == 'app' - name: Copy $app_name_pretty app to Applications directory command: cp -R $app_name/$app_name.app /Applications chdir=$downloads when_string: $installer_type == 'app' @@ -12,4 +17,4 @@ command: sudo installer -package $app_name/$app_name.pkg -target $install_target chdir=$downloads when_string: $installer_type == 'pkg' - name: Remove extraction directory - file: path=${downloads}${app_name}/ state=absent \ No newline at end of file + file: path=$downloads$app_name/ state=absent \ No newline at end of file diff --git a/install/zip.yaml b/install/zip.yaml index 2783dca..f88e404 100644 --- a/install/zip.yaml +++ b/install/zip.yaml @@ -1,10 +1,15 @@ --- - name: Download $app_name_pretty - get_url: url=$app_url dest=${downloads}/$app_name.zip + get_url: url=$app_url dest=$downloads/$app_name.zip +- name: Remove existing extraction directory if present + file: path=$downloads$app_name/ state=absent - name: Create an extraction directory - file: path=${downloads}${app_name}/ state=directory + file: path=$downloads$app_name/ state=directory - name: Extract $app_name_pretty zip archive command: unzip $app_name.zip -d $app_name/ chdir=$downloads +- name: Remove existing app if present + file: path=/Applications/$app_name.app state=absent + when_string: $installer_type == 'app' - name: Copy $app_name_pretty app to Applications directory command: cp -R $app_name/$app_name.app /Applications chdir=$downloads when_string: $installer_type == 'app' @@ -12,4 +17,4 @@ command: sudo installer -package $app_name/$app_name.pkg -target $install_target chdir=$downloads when_string: $installer_type == 'pkg' - name: Remove extraction directory - file: path=${downloads}${app_name}/ state=absent \ No newline at end of file + file: path=$downloads$app_name/ state=absent \ No newline at end of file