Vagrant 可以在另一个 Vagrant VM 中使用 Ansible 安装来配置 VM 吗? [英] Can Vagrant provision a VM using an Ansible installation in another Vagrant VM?

查看:32
本文介绍了Vagrant 可以在另一个 Vagrant VM 中使用 Ansible 安装来配置 VM 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用 Ansible 和 Vagrant 来引导本地开发环境(我们称之为 dev-server-1)并且主机是一台 Windows 机器(win-host).

I just started using Ansible and Vagrant to bootstrap a local development environment (let's call it dev-server-1) and the host is a Windows machine (win-host).

我必须使用 Ansible 配置 dev-server-1 机器,但是 win-host 运行的是 Windows,所以我想知道是否可以使用另一个 Vagrant VM(ansible-host,运行一个安装了 Ansible 的最小盒子)只为 Ansible,但让 dev-server-1win-host 上运行.这可行吗?

I have to provision dev-server-1 machine using Ansible, but win-host is running Windows so I was wondering if I could use another Vagrant VM (ansible-host, running a minimal box with Ansible installed) just for Ansible, but leaving dev-server-1 running on win-host. Is this feasible?

推荐答案

您将无法使用内置的 Ansible 配置器 在 Vagrant 中,因为它依赖于安装了 Ansible 的主机以及支持 ControlPersist 的操作系统(Windows 不支持).

You won't be able to use the built in Ansible provisioner in Vagrant as that relies on the host having both Ansible installed and also an OS that supports ControlPersist (which Windows doesn't).

然而,您可以使用 Vagrant 来启动您的裸虚拟机,然后使用安装了 Ansible 的单独虚拟机(可能由 Vagrant 创建)来配置这些其他虚拟机.

You could however use Vagrant to spin up your bare VMs and then use a separate VM (possibly created by Vagrant) with Ansible installed to then configure these other VMs.

您唯一需要的是在 VM 之间建立网络连接.

The only thing you would need for that is for there to be network connectivity between the VMs.

不幸的是,您将无法使用 Vagrant 在运行 Ansible 配置器时创建的自动生成的清单,因为它需要运行 Ansible 配置器.据我所知,如果不运行 Ansible 配置程序,就无法获得此清单.

Unfortunately you will not be able to use the auto generated inventory that Vagrant creates on running an Ansible provisioner as it requires an Ansible provisioner to be run. As far as I know there is no way to get this inventory without running the Ansible provisioner.

这篇关于Vagrant 可以在另一个 Vagrant VM 中使用 Ansible 安装来配置 VM 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆