简体   繁体   English

如何使用 ansibe 安装特定版本的 apt-package

[英]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.我有一个 ansible playbook,如下所示,我正在 ubuntu 机器上安装 nginx。

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

I want to upgrade nginx to version "x".我想将 nginx 升级到版本“x”。 I don't want to use state: latest .我不想使用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.您可以在 name 参数上使用=<version>指定版本。
For example:例如:

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

Take a look at the documentation .查看文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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