2014-06-19 18:32:43 +00:00
|
|
|
# test code for the win_msi module
|
|
|
|
# (c) 2014, Chris Church <chris@ninemoreminutes.com>
|
|
|
|
|
|
|
|
# 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 <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
- name: use win_get_url module to download msi
|
2015-08-22 23:12:49 +00:00
|
|
|
win_get_url:
|
2015-09-15 05:13:30 +00:00
|
|
|
url: "{{msi_url}}"
|
|
|
|
dest: "{{msi_download_path}}"
|
2014-06-19 18:32:43 +00:00
|
|
|
register: win_get_url_result
|
|
|
|
|
2015-09-15 05:13:30 +00:00
|
|
|
- name: make sure msi is uninstalled
|
2015-08-22 23:12:49 +00:00
|
|
|
win_msi:
|
2015-09-15 05:13:30 +00:00
|
|
|
path: "{{msi_product_code|default(msi_download_path,true)}}"
|
2015-08-22 23:12:49 +00:00
|
|
|
state: absent
|
2016-07-08 05:46:27 +00:00
|
|
|
wait: true
|
2015-08-22 23:12:49 +00:00
|
|
|
ignore_errors: true
|
|
|
|
|
2015-09-15 05:13:30 +00:00
|
|
|
- name: install msi
|
2015-08-22 23:12:49 +00:00
|
|
|
win_msi:
|
2015-09-15 05:13:30 +00:00
|
|
|
path: "{{msi_download_path}}"
|
2016-07-08 05:46:27 +00:00
|
|
|
wait: true
|
2014-06-19 18:32:43 +00:00
|
|
|
register: win_msi_install_result
|
|
|
|
|
|
|
|
- name: check win_msi install result
|
2015-08-22 23:12:49 +00:00
|
|
|
assert:
|
2014-06-19 18:32:43 +00:00
|
|
|
that:
|
|
|
|
- "not win_msi_install_result|failed"
|
|
|
|
- "win_msi_install_result|changed"
|
|
|
|
|
2015-09-15 05:13:30 +00:00
|
|
|
- name: install msi again with creates argument
|
2015-08-22 23:12:49 +00:00
|
|
|
win_msi:
|
2015-09-15 05:13:30 +00:00
|
|
|
path: "{{msi_download_path}}"
|
2016-07-08 05:46:27 +00:00
|
|
|
wait: true
|
2015-09-15 05:13:30 +00:00
|
|
|
creates: "{{msi_install_path}}"
|
2015-08-22 23:12:49 +00:00
|
|
|
register: win_msi_install_again_result
|
|
|
|
|
|
|
|
- name: check win_msi install again result
|
2016-07-29 04:03:14 +00:00
|
|
|
# ignore errors because test/module is unreliable
|
|
|
|
ignore_errors: true
|
2015-08-22 23:12:49 +00:00
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "not win_msi_install_again_result|failed"
|
|
|
|
- "not win_msi_install_again_result|changed"
|
|
|
|
|
2015-09-15 05:13:30 +00:00
|
|
|
- name: uninstall msi
|
2015-08-22 23:12:49 +00:00
|
|
|
win_msi:
|
2015-09-15 05:13:30 +00:00
|
|
|
path: "{{msi_download_path}}"
|
2016-07-08 05:46:27 +00:00
|
|
|
wait: true
|
2015-08-22 23:12:49 +00:00
|
|
|
state: absent
|
2014-06-19 18:32:43 +00:00
|
|
|
register: win_msi_uninstall_result
|
|
|
|
|
|
|
|
- name: check win_msi uninstall result
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "not win_msi_uninstall_result|failed"
|
|
|
|
- "win_msi_uninstall_result|changed"
|