PageRenderTime 15ms CodeModel.GetById 9ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/test/integration/roles/test_win_raw/tasks/main.yml

https://github.com/ajanthanm/ansible
YAML | 72 lines | 47 code | 9 blank | 16 comment | 0 complexity | e69dce1687189ff5c7727366c8a9d0e3 MD5 | raw file
 1# test code for the raw module when using winrm connection
 2# (c) 2014, Chris Church <chris@ninemoreminutes.com>
 3
 4# This file is part of Ansible
 5#
 6# Ansible is free software: you can redistribute it and/or modify
 7# it under the terms of the GNU General Public License as published by
 8# the Free Software Foundation, either version 3 of the License, or
 9# (at your option) any later version.
10#
11# Ansible is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.
18
19- name: run getmac
20  raw: getmac
21  register: getmac_result
22
23- name: assert that getmac ran
24  assert:
25    that:
26      - "getmac_result.rc == 0"
27      - "getmac_result.stdout"
28      - "not getmac_result.stderr"
29      - "not getmac_result|failed"
30      - "not getmac_result|changed"
31
32- name: run ipconfig with /all argument
33  raw: ipconfig /all
34  register: ipconfig_result
35
36- name: assert that ipconfig ran with /all argument
37  assert:
38    that:
39      - "ipconfig_result.rc == 0"
40      - "ipconfig_result.stdout"
41      - "'Physical Address' in ipconfig_result.stdout"
42      - "not ipconfig_result.stderr"
43      - "not ipconfig_result|failed"
44      - "not ipconfig_result|changed"
45
46- name: run ipconfig with invalid argument
47  raw: ipconfig /badswitch
48  register: ipconfig_invalid_result
49  ignore_errors: true
50
51- name: assert that ipconfig with invalid argument failed
52  assert:
53    that:
54      - "ipconfig_invalid_result.rc != 0"
55      - "ipconfig_invalid_result.stdout" # ipconfig displays errors on stdout.
56      - "not ipconfig_invalid_result.stderr"
57      - "ipconfig_invalid_result|failed"
58      - "not ipconfig_invalid_result|changed"
59
60- name: run an unknown command
61  raw: uname -a
62  register: unknown_result
63  ignore_errors: true
64
65- name: assert that an unknown command failed
66  assert:
67    that:
68      - "unknown_result.rc != 0"
69      - "not unknown_result.stdout"
70      - "unknown_result.stderr" # An unknown command displays error on stderr.
71      - "unknown_result|failed"
72      - "not unknown_result|changed"