PageRenderTime 14ms CodeModel.GetById 11ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://github.com/ajanthanm/ansible
YAML | 42 lines | 17 code | 9 blank | 16 comment | 0 complexity | 27ef6464bea52990bd2e5d98813e54ec MD5 | raw file
 1# test code for the changed_when parameter
 2# (c) 2014, James Tanner <tanner.jc@gmail.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: ensure shell is always changed
20  shell: ls -al /tmp
21  register: shell_result
22
23- debug: var=shell_result
24
25- name: changed should always be true for shell
26  assert: 
27    that:
28       - "shell_result.changed"
29
30- name: test changed_when override for shell
31  shell: ls -al /tmp
32  changed_when: False
33  register: shell_result
34
35- debug: var=shell_result
36
37- name: changed should be false
38  assert: 
39    that:
40       - "not shell_result.changed"
41
42