mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Add update_only parameter for yum module (#22206)
* Add update_only parameter for yum module When using latest, `update_only: yes` will ensure that only existing packages are updated and no additional packages are installed. * Update yum.py Update version added for `update_only` parameter to 2.5 * add unit tests for update_only flag in yum module
This commit is contained in:
parent
1378861fe7
commit
9c6ad3d076
2 changed files with 50 additions and 5 deletions
|
@ -427,3 +427,32 @@
|
|||
that:
|
||||
- "'changed' in yum_result"
|
||||
- "'msg' in yum_result"
|
||||
|
||||
- name: use latest to install httpd
|
||||
yum:
|
||||
name: httpd
|
||||
state: latest
|
||||
register: yum_result
|
||||
|
||||
- name: verify httpd was installed
|
||||
assert:
|
||||
that:
|
||||
- "'changed' in yum_result"
|
||||
|
||||
- name: uninstall httpd
|
||||
yum:
|
||||
name: httpd
|
||||
state: removed
|
||||
|
||||
- name: update httpd only if it exists
|
||||
yum:
|
||||
name: httpd
|
||||
state: latest
|
||||
update_only: yes
|
||||
register: yum_result
|
||||
|
||||
- name: verify httpd not installed
|
||||
assert:
|
||||
that:
|
||||
- "not yum_result.changed"
|
||||
- "'Packages providing httpd not installed due to update_only specified' in yum_result.results"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue