VM中使用Ansible安装来配置VM吗

VM中使用Ansible安装来配置VM吗

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

问题描述

我刚刚开始使用Ansible and 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-1 win-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的单独VM(可能由Vagrant创建)来配置其他VM.

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.

您唯一需要做的就是在虚拟机之间建立网络连接.

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吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 17:58