mirror of https://github.com/ansible/ansible.git
yum: fix changed in group remove
parent
9aa5e0cc3e
commit
98b19f0623
@ -0,0 +1,142 @@
|
|||||||
|
- name: install a group to test and yum-utils
|
||||||
|
yum:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
with_items:
|
||||||
|
- "@Development Tools"
|
||||||
|
- yum-utils
|
||||||
|
|
||||||
|
- name: check mode remove the group
|
||||||
|
yum:
|
||||||
|
name: "@Development Tools"
|
||||||
|
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:
|
||||||
|
name: "@Development Tools"
|
||||||
|
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:
|
||||||
|
name: "@Development Tools"
|
||||||
|
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:
|
||||||
|
name: "@Development Tools"
|
||||||
|
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:
|
||||||
|
name: "@Development Tools,sos"
|
||||||
|
state: present
|
||||||
|
register: yum_output
|
||||||
|
|
||||||
|
- debug: var=yum_output
|
||||||
|
|
||||||
|
- name: check mode remove the group along with the package
|
||||||
|
yum:
|
||||||
|
name: "@Development Tools,sos"
|
||||||
|
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:
|
||||||
|
name: "@Development Tools,sos"
|
||||||
|
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:
|
||||||
|
name: "@Development Tools,sos"
|
||||||
|
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"
|
||||||
Loading…
Reference in New Issue