summaryrefslogtreecommitdiff
path: root/test/integration/roles/test_win_msi/tasks/main.yml
blob: 1ac467212a04e83a38e0b6e290cc505f0597a95a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# 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
  win_get_url:
    url: "{{msi_url}}"
    dest: "{{msi_download_path}}"
  register: win_get_url_result

- 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:
    that:
      - "not win_msi_install_result|failed"
      - "win_msi_install_result|changed"

- 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
  assert: 
    that:
      - "not win_msi_uninstall_result|failed"
      - "win_msi_uninstall_result|changed"