mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
69 lines
1.4 KiB
YAML
69 lines
1.4 KiB
YAML
# UNINSTALL
|
|
- name: uninstall hello with apt
|
|
apt: pkg=hello state=absent purge=yes
|
|
register: apt_result
|
|
|
|
- name: check hello with dpkg
|
|
shell: dpkg --get-selections | fgrep hello
|
|
failed_when: False
|
|
register: dpkg_result
|
|
|
|
- debug: var=apt_result
|
|
- debug: var=dpkg_result
|
|
|
|
- name: verify uninstallation of hello
|
|
assert:
|
|
that:
|
|
- "'changed' in apt_result"
|
|
- "dpkg_result.rc == 1"
|
|
|
|
# UNINSTALL AGAIN
|
|
- name: uninstall hello with apt
|
|
apt: pkg=hello state=absent purge=yes
|
|
register: apt_result
|
|
|
|
- name: verify no change on re-uninstall
|
|
assert:
|
|
that:
|
|
- "not apt_result.changed"
|
|
|
|
# INSTALL
|
|
- name: install hello with apt
|
|
apt: name=hello state=present
|
|
register: apt_result
|
|
|
|
- name: check hello with dpkg
|
|
shell: dpkg --get-selections | fgrep hello
|
|
failed_when: False
|
|
register: dpkg_result
|
|
|
|
- debug: var=apt_result
|
|
- debug: var=dpkg_result
|
|
|
|
- name: verify installation of hello
|
|
assert:
|
|
that:
|
|
- "apt_result.changed"
|
|
- "dpkg_result.rc == 0"
|
|
|
|
- name: verify apt module outputs
|
|
assert:
|
|
that:
|
|
- "'invocation' in apt_result"
|
|
- "'changed' in apt_result"
|
|
- "'item' in apt_result"
|
|
- "'stderr' in apt_result"
|
|
- "'stdout' in apt_result"
|
|
- "'stdout_lines' in apt_result"
|
|
|
|
# INSTALL AGAIN
|
|
- name: install hello with apt
|
|
apt: name=hello state=present
|
|
register: apt_result
|
|
|
|
- name: verify no change on re-install
|
|
assert:
|
|
that:
|
|
- "not apt_result.changed"
|
|
|
|
|