[deyu1@kvm19 ansible]$ ansible-doc yum | grep ^EX -A10 EXAMPLES: - name: Install the latest version of Apache ansible.builtin.yum: name: httpd state: latest - name: Install Apache >= 2.4 ansible.builtin.yum: name: httpd>=2.4 state: present
[deyu1@kvm19 ansible]$ ansible dev -m yum -a "name=vim state=absent" kvm11 | SUCCESS => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python3" }, "changed": false, "msg": "Nothing to do", "rc": 0, "results": [] }
[deyu1@kvm19 ansible]$ ansible dev -m yum -a "name=vim state=latest" kvm11 | CHANGED => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python3" }, "changed": true, "msg": "", "rc": 0, "results": [ "Installed: vim-common-2:8.2.2637-16.el9_0.3.x86_64", "Installed: vim-enhanced-2:8.2.2637-16.el9_0.3.x86_64", "Installed: vim-filesystem-2:8.2.2637-16.el9_0.3.noarch", "Installed: gpm-libs-1.20.7-29.el9.x86_64" ] }