PageRenderTime 18ms CodeModel.GetById 10ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/test/integration/roles/test_yum/tasks/yum.yml

https://github.com/ajanthanm/ansible
YAML | 86 lines | 58 code | 16 blank | 12 comment | 0 complexity | 83bbf3d3e311293bb7cb9a0b4b493f63 MD5 | raw file
 1# UNINSTALL 'yum-utils'
 2#  The `yum` module has the smarts to auto-install `yum-utils`.  To test, we
 3#  will first uninstall `yum-utils`.
 4- name: check yum-utils with rpm
 5  shell: rpm -q yum-utils
 6  register: rpm_result
 7  ignore_errors: true
 8
 9# Don't uninstall yum-utils with the `yum` module, it would be bad.  The `yum`
10# module does some `repoquery` magic after removing a package.  It fails when you
11# remove `yum-utils.
12- name: uninstall yum-utils with shell
13  shell: yum -y remove yum-utils
14  when: rpm_result|success
15
16# UNINSTALL
17#   With 'yum-utils' uninstalled, the first call to 'yum' should install
18#   yum-utils.
19- name: uninstall sos
20  yum: name=sos state=removed
21  register: yum_result
22
23- name: check sos with rpm
24  shell: rpm -q sos
25  failed_when: False
26  register: rpm_result
27
28- debug: var=yum_result
29- debug: var=rpm_result
30
31- name: verify uninstalltion of sos
32  assert:
33    that: 
34        - "yum_result.rc == 0"
35        - "rpm_result.rc == 1"
36
37# UNINSTALL AGAIN
38- name: uninstall sos again
39  yum: name=sos state=removed
40  register: yum_result
41
42- name: verify no change on re-uninstall
43  assert:
44    that: 
45        - "not yum_result.changed"
46
47# INSTALL
48- name: install sos
49  yum: name=sos state=present
50  register: yum_result
51
52- name: check sos with rpm
53  shell: rpm -q sos
54  failed_when: False
55  register: rpm_result
56
57- debug: var=yum_result
58- debug: var=rpm_result
59
60- name: verify installation of sos
61  assert:
62    that: 
63        - "yum_result.rc == 0"
64        - "yum_result.changed"
65        - "rpm_result.rc == 0"
66
67- name: verify yum module outputs
68  assert:
69    that:
70        - "'invocation' in yum_result"
71        - "'changed' in yum_result"
72        - "'msg' in yum_result"
73        - "'rc' in yum_result"
74        - "'results' in yum_result"
75
76# INSTALL AGAIN        
77- name: install sos again
78  yum: name=sos state=present
79  register: yum_result
80
81- name: verify no change on second install
82  assert:
83    that: 
84        - "not yum_result.changed"
85 
86