'Install specific version of package using ansible
I want to install pexpect using Ansible.
I am using ansible.builtin.package module. But old version is getting installed. I need pexpect version >=3.3.
How can I achieve that using this module?
Solution 1:[1]
Using Fedora 35 as example, the syntax is <package_name>-<package_version>.
In this example I'm using ansible ad-hoc command for installing version 4.8.0-6.fc35 of the screen package. You have to replace <hostname> with the host you want to update.
ansible <hostname> -m package -a "name=screen-4.8.0-6.fc35 state=present" --become -K
The result of such command is.
hostname | CHANGED => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": true,
"msg": "",
"rc": 0,
"results": [
"Installed: screen-4.8.0-6.fc35.x86_64"
]
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Antonio Costa |
