How do I work with packages using ansible?
-
Link: http://docs.ansible.com/ansible/yum_module.html
Link: http://docs.ansible.com/ansible/apt_module.html
Link: http://docs.ansible.com/ansible/zypper_module.htmlAnsible has yum, apt, etc for which ever OS you are trying to install the package on.
Install
$ ansible perth -b -m yum -a "name=nginx state=present"
Ensure latest package is installed
$ ansible perth -b -m yum -a "name=nginx state=latest" ip-xxxx.us-west-2.compute.internal | SUCCESS => { "changed": false, "msg": "", "rc": 0, "results": [ "All packages providing nginx are up to date", "" ] }
Ensure a package does not exist, or remove it
$ ansible perth -b -m yum -a "name=nginx state=absent"
© Lightnetics 2024