diff --git a/test/integration/roles/test_win_package/defaults/main.yml b/test/integration/roles/test_win_package/defaults/main.yml new file mode 100644 index 0000000000..ebc97b84cc --- /dev/null +++ b/test/integration/roles/test_win_package/defaults/main.yml @@ -0,0 +1,6 @@ +--- + +msi_url: https://ansible-ci-files.s3.amazonaws.com/test/integration/roles/test_win_msi/7z922-x64.msi +msi_download_path: "C:\\Program Files\\7z922-x64.msi" +msi_install_path: "C:\\Program Files\\7-Zip" +msi_product_code: "{23170F69-40C1-2702-0922-000001000000}" diff --git a/test/integration/roles/test_win_package/tasks/main.yml b/test/integration/roles/test_win_package/tasks/main.yml new file mode 100644 index 0000000000..3df394fc75 --- /dev/null +++ b/test/integration/roles/test_win_package/tasks/main.yml @@ -0,0 +1,81 @@ +# test code for the win_package module +# (c) 2014, Chris Church + +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +- name: use win_get_url module to download msi + win_get_url: + url: "{{msi_url}}" + dest: "{{msi_download_path}}" + register: win_get_url_result + +- name: make sure msi is uninstalled + win_package: + path: "{{msi_download_path}}" + product_id: "{{msi_product_code}}" + state: absent + +- name: install msi + win_package: + path: "{{msi_download_path}}" + product_id: "{{msi_product_code}}" + state: present + register: win_package_install_result + +- name: check win_package install result + assert: + that: + - "not win_package_install_result|failed" + - "win_package_install_result|changed" + +- name: install msi again (check for no change) + win_package: + path: "{{msi_download_path}}" + product_id: "{{msi_product_code}}" + state: present + register: win_package_install_again_result + +- name: check win_package install again result + assert: + that: + - "not win_package_install_again_result|failed" + - "not win_package_install_again_result|changed" + +- name: uninstall msi + win_package: + path: "{{msi_download_path}}" + product_id: "{{msi_product_code}}" + state: absent + register: win_package_uninstall_result + +- name: check win_package uninstall result + assert: + that: + - "not win_package_uninstall_result|failed" + - "win_package_uninstall_result|changed" + +- name: uninstall msi again (check for no change) + win_package: + path: "{{msi_download_path}}" + product_id: "{{msi_product_code}}" + state: absent + register: win_package_uninstall_again_result + +- name: check win_package uninstall result + assert: + that: + - "not win_package_uninstall_result|failed" + - "not win_package_uninstall_again_result|changed" diff --git a/test/integration/test_win_group2.yml b/test/integration/test_win_group2.yml index 17bbee0a7d..c276e9c1e7 100644 --- a/test/integration/test_win_group2.yml +++ b/test/integration/test_win_group2.yml @@ -9,3 +9,4 @@ - { role: test_win_stat, tags: test_win_stat } - { role: test_win_get_url, tags: test_win_get_url } - { role: test_win_msi, tags: test_win_msi } + - { role: test_win_package, tags: test_win_package }