vagrant/ansible nginx 版本错误

vagrant/ansible wrong version of nginx

拥有 Vagrantfile:

...
    Vagrant.configure(2) do |config|
      config.vm.box = "hashicorp/precise64"
      config.vm.box_url = "https://atlas.hashicorp.com/hashicorp/boxes/precise64"
      config.vm.hostname = vm_hostname
      config.vm.boot_timeout = 720
...

尝试使用 *.yml 安装 nginx:

- name: Install Nginx
  become: yes
  apt: pkg=nginx state=latest

在有 VM 的结果中,键入 "nginx -v" 给出了“1.1.19”,这是非常过时的(ppa:ngins/stable 截至日期有 1.12 作为稳定版)

请帮忙安装最新版本的nginx)

您使用的是一个非常旧的盒子(我什至会说已弃用,因为 hashicorp 已将这些盒子重建为 ubuntu/precise64 - the box you're using has not been updated for 3 years (check https://atlas.hashicorp.com/hashicorp/boxes/precise64))

所以你可以试试

config.vm.box = "ubuntu/precise64"

但请注意 ubuntu 12.04 作为 ubuntu 版本已经很旧了,您应该使用更新的版本,您可以使用

  • ubuntu/trusty64 : 它的 ubuntu 14.04
  • ubuntu/xenial64:它的 ubuntu 16.04(这个盒子过去有一些问题,不确定是否一切都已修复)