1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #12050 from cchurch/test_win_msi_creates

Add tests for creates parameter to win_msi module.
This commit is contained in:
Chris Church 2015-09-16 16:22:47 -04:00
commit b44e02143a
2 changed files with 35 additions and 6 deletions

View file

@ -0,0 +1,6 @@
---
msi_url: http://downloads.sourceforge.net/project/sevenzip/7-Zip/9.22/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}"

View file

@ -17,21 +17,44 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- name: use win_get_url module to download msi
win_get_url: url=http://downloads.sourceforge.net/project/sevenzip/7-Zip/9.22/7z922-x64.msi dest='C:\\7z922-x64.msi'
win_get_url:
url: "{{msi_url}}"
dest: "{{msi_download_path}}"
register: win_get_url_result
- name: install 7zip msi
win_msi: path="{{ win_get_url_result.win_get_url.dest }}"
- name: make sure msi is uninstalled
win_msi:
path: "{{msi_product_code|default(msi_download_path,true)}}"
state: absent
ignore_errors: true
- name: install msi
win_msi:
path: "{{msi_download_path}}"
register: win_msi_install_result
- name: check win_msi install result
assert:
assert:
that:
- "not win_msi_install_result|failed"
- "win_msi_install_result|changed"
- name: uninstall 7zip msi
win_msi: path="{{ win_get_url_result.win_get_url.dest }}" state=absent
- name: install msi again with creates argument
win_msi:
path: "{{msi_download_path}}"
creates: "{{msi_install_path}}"
register: win_msi_install_again_result
- name: check win_msi install again result
assert:
that:
- "not win_msi_install_again_result|failed"
- "not win_msi_install_again_result|changed"
- name: uninstall msi
win_msi:
path: "{{msi_download_path}}"
state: absent
register: win_msi_uninstall_result
- name: check win_msi uninstall result