Last active
December 16, 2020 09:40
-
-
Save goldyfruit/f4f274be3144e6afca69 to your computer and use it in GitHub Desktop.
[ansible] Check via the yum module and a registered value if a package is installed or not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Ansible tests playbook | |
hosts: all | |
remote_user: root | |
tasks: | |
- name: Check if mariadb-libs-5.5.44-2.el7.centos.x86_64 package is installed | |
yum: | |
list=mariadb-libs-5.5*x86_64 | |
register: pkg | |
- name: Removing old mariadb-libs package | |
package: | |
name=mariadb-libs | |
state=absent | |
when: ansible_os_family == 'RedHat' and | |
pkg.results[0].yumstate == 'installed' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the package_facts module maybe better for this.