简体   繁体   中英

How to install a particular version of an apt-package using ansibe

I have an ansible playbook as below, where I'm installing nginx on an ubuntu machine.

- apt:
   name: nginx
   state: present
   update_cache: yes

I want to upgrade nginx to version "x". I don't want to use state: latest . Is there a way to specify the version which I want to install?

You can specify the version with =<version> on the name parameter.
For example:

- apt:
   name: "nginx=1.14.0-0ubuntu1.9"
   state: present
   update_cache: yes

Take a look at the documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM