ceuser@deyu:~/ansible_pb$ vi deploy1.yml
ceuser@deyu:~/ansible_pb$ cat deploy1.yml
---
- hosts: dev
tasks:
- name: Install the latest version of ...
ansible.builtin.dnf:
name: "{{item}}"
state: latest
ceuser@deyu:~/ansible_pb$ ansible-playbook deploy1.yml --extra-vars "item=php" PLAY [dev] ********************************************************************* TASK [Gathering Facts] ********************************************************* ok: [kvm11] TASK [Install the latest version of ...] *************************************** changed: [kvm11] PLAY RECAP ********************************************************************* kvm11 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
ceuser@deyu:~/ansible_pb$ ansible dev -m dnf -a "name=php state=present"
kvm11 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"msg": "Nothing to do",
"rc": 0,
"results": []
}