PageRenderTime 24ms CodeModel.GetById 20ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/test/integration/roles/test_apt/tasks/apt.yml

https://github.com/ajanthanm/ansible
YAML | 80 lines | 56 code | 15 blank | 9 comment | 0 complexity | 9b52da06b11bbce53a1f458f91316bf2 MD5 | raw file
 1# UNINSTALL 'python-apt'
 2#  The `apt` module has the smarts to auto-install `python-apt`.  To test, we
 3#  will first uninstall `python-apt`.
 4- name: check python-apt with dpkg
 5  shell: dpkg -s python-apt
 6  register: dpkg_result
 7  ignore_errors: true
 8
 9- name: uninstall python-apt with apt
10  apt: pkg=python-apt state=absent purge=yes
11  register: apt_result
12  when: dpkg_result|success
13
14# UNINSTALL 'hello'
15#   With 'python-apt' uninstalled, the first call to 'apt' should install
16#   python-apt.
17- name: uninstall hello with apt
18  apt: pkg=hello state=absent purge=yes
19  register: apt_result
20
21- name: check hello with dpkg
22  shell: dpkg --get-selections | fgrep hello
23  failed_when: False
24  register: dpkg_result
25
26- name: verify uninstallation of hello
27  assert:
28    that:
29        - "'changed' in apt_result"
30        - "dpkg_result.rc == 1"
31
32# UNINSTALL AGAIN
33- name: uninstall hello with apt
34  apt: pkg=hello state=absent purge=yes
35  register: apt_result
36
37- name: verify no change on re-uninstall
38  assert:
39    that:
40        - "not apt_result.changed"
41
42# INSTALL
43- name: install hello with apt
44  apt: name=hello state=present
45  register: apt_result
46
47- name: check hello with dpkg
48  shell: dpkg --get-selections | fgrep hello
49  failed_when: False
50  register: dpkg_result
51
52- debug: var=apt_result
53- debug: var=dpkg_result
54
55- name: verify installation of hello
56  assert:
57    that:
58        - "apt_result.changed"
59        - "dpkg_result.rc == 0"
60
61- name: verify apt module outputs
62  assert:
63    that:
64        - "'invocation' in apt_result"
65        - "'changed' in apt_result"
66        - "'stderr' in apt_result"
67        - "'stdout' in apt_result"
68        - "'stdout_lines' in apt_result"
69
70# INSTALL AGAIN
71- name: install hello with apt
72  apt: name=hello state=present
73  register: apt_result
74
75- name: verify no change on re-install
76  assert:
77    that:
78        - "not apt_result.changed"
79
80