2017-08-22 23:34:59 +02:00
|
|
|
- name: install a group to test and yum-utils
|
|
|
|
yum:
|
2019-10-23 21:02:25 +02:00
|
|
|
name: "{{ pkgs }}"
|
2017-08-22 23:34:59 +02:00
|
|
|
state: present
|
2019-10-23 21:02:25 +02:00
|
|
|
vars:
|
|
|
|
pkgs:
|
|
|
|
- "@Custom Group"
|
|
|
|
- yum-utils
|
2018-08-27 19:17:47 +02:00
|
|
|
when: ansible_pkg_mgr == "yum"
|
|
|
|
|
|
|
|
- name: install a group to test and dnf-utils
|
|
|
|
yum:
|
2019-10-23 21:02:25 +02:00
|
|
|
name: "{{ pkgs }}"
|
2018-08-27 19:17:47 +02:00
|
|
|
state: present
|
2019-10-23 21:02:25 +02:00
|
|
|
vars:
|
|
|
|
pkgs:
|
|
|
|
- "@Custom Group"
|
|
|
|
- dnf-utils
|
2018-08-27 19:17:47 +02:00
|
|
|
when: ansible_pkg_mgr == "dnf"
|
2017-08-22 23:34:59 +02:00
|
|
|
|
|
|
|
- name: check mode remove the group
|
|
|
|
yum:
|
2019-05-21 17:32:37 +02:00
|
|
|
name: "@Custom Group"
|
2017-08-22 23:34:59 +02:00
|
|
|
state: absent
|
|
|
|
check_mode: yes
|
|
|
|
register: yum_result
|
|
|
|
|
|
|
|
- name: verify changed
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "yum_result.changed"
|
|
|
|
|
|
|
|
- name: verify yum module outputs
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "'changed' in yum_result"
|
|
|
|
- "'results' in yum_result"
|
|
|
|
|
|
|
|
- name: remove the group
|
|
|
|
yum:
|
2019-05-21 17:32:37 +02:00
|
|
|
name: "@Custom Group"
|
2017-08-22 23:34:59 +02:00
|
|
|
state: absent
|
|
|
|
register: yum_result
|
|
|
|
|
|
|
|
- name: verify changed
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "yum_result.rc == 0"
|
|
|
|
- "yum_result.changed"
|
|
|
|
|
|
|
|
- name: verify yum module outputs
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "'changed' in yum_result"
|
|
|
|
- "'msg' in yum_result"
|
|
|
|
- "'results' in yum_result"
|
|
|
|
|
|
|
|
- name: remove the group again
|
|
|
|
yum:
|
2019-05-21 17:32:37 +02:00
|
|
|
name: "@Custom Group"
|
2017-08-22 23:34:59 +02:00
|
|
|
state: absent
|
|
|
|
register: yum_result
|
|
|
|
|
|
|
|
- name: verify changed
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "not yum_result.changed"
|
|
|
|
|
|
|
|
- name: verify yum module outputs
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "'changed' in yum_result"
|
|
|
|
- "'msg' in yum_result"
|
|
|
|
- "'results' in yum_result"
|
|
|
|
|
|
|
|
- name: check mode remove the group again
|
|
|
|
yum:
|
2019-05-21 17:32:37 +02:00
|
|
|
name: "@Custom Group"
|
2017-08-22 23:34:59 +02:00
|
|
|
state: absent
|
|
|
|
check_mode: yes
|
|
|
|
register: yum_result
|
|
|
|
|
|
|
|
- name: verify changed
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "not yum_result.changed"
|
|
|
|
|
|
|
|
- name: verify yum module outputs
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "'changed' in yum_result"
|
|
|
|
- "'results' in yum_result"
|
|
|
|
|
|
|
|
- name: install a group and a package to test
|
|
|
|
yum:
|
2019-05-21 17:32:37 +02:00
|
|
|
name: "@Custom Group,sos"
|
2017-08-22 23:34:59 +02:00
|
|
|
state: present
|
|
|
|
register: yum_output
|
|
|
|
|
|
|
|
- name: check mode remove the group along with the package
|
|
|
|
yum:
|
2019-05-21 17:32:37 +02:00
|
|
|
name: "@Custom Group,sos"
|
2017-08-22 23:34:59 +02:00
|
|
|
state: absent
|
|
|
|
register: yum_result
|
|
|
|
check_mode: yes
|
|
|
|
|
|
|
|
- name: verify changed
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "yum_result.changed"
|
|
|
|
|
|
|
|
- name: verify yum module outputs
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "'changed' in yum_result"
|
|
|
|
- "'results' in yum_result"
|
|
|
|
|
|
|
|
- name: remove the group along with the package
|
|
|
|
yum:
|
2019-05-21 17:32:37 +02:00
|
|
|
name: "@Custom Group,sos"
|
2017-08-22 23:34:59 +02:00
|
|
|
state: absent
|
|
|
|
register: yum_result
|
|
|
|
|
|
|
|
- name: verify changed
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "yum_result.changed"
|
|
|
|
|
|
|
|
- name: verify yum module outputs
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "'changed' in yum_result"
|
|
|
|
- "'msg' in yum_result"
|
|
|
|
- "'results' in yum_result"
|
|
|
|
|
|
|
|
- name: check mode remove the group along with the package
|
|
|
|
yum:
|
2019-05-21 17:32:37 +02:00
|
|
|
name: "@Custom Group,sos"
|
2017-08-22 23:34:59 +02:00
|
|
|
state: absent
|
|
|
|
register: yum_result
|
|
|
|
check_mode: yes
|
|
|
|
|
|
|
|
- name: verify not changed
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "not yum_result.changed"
|
|
|
|
|
|
|
|
- name: verify yum module outputs
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "'changed' in yum_result"
|
|
|
|
- "'results' in yum_result"
|