似乎Vagrant不允许我使用Vmware在
Windows上自动配置Ansible配置器.
我不确定Ansible是否必须安装在主机上(在我的情况下是Windows)或客户机上.
我尝试使用以下shell脚本自动配置来宾计算机:
#!/usr/bin/env bash apt-get update -y apt-get install openssh-client openssh-server python-pycurl software-properties-common python-software-properties nano -y sleep 2 echo "deb http://ppa.launchpad.net/rquillo/ansible/ubuntu precise main" >> /etc/apt/sources.list echo "deb-src http://ppa.launchpad.net/rquillo/ansible/ubuntu precise main" >> /etc/apt/sources.list sleep 2 apt-get install ansible -y
哪个安装Ansible完全没问题,但我的命令提示符告诉我以下消息:
The executable ansible-playbook Vagrant is trying to run was not found in the %PATH% variable
在检查客人并尝试执行’ansible-playbook’时,它完全认可该命令.
然后我想也许Vagrant在客人的路径环境变量中需要’ansible-playbook’.
我运行以下命令将’ansible-playbook’添加到我的linux客户机上的PATH变量中.
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/ruby/bin/:ansible-playbook
也没工作.
这让我得出Ansible需要安装在主机上的结论,因为%PATH%在Windows上看起来也是必需的.
由于Ansible目前不适用于Windows,我可能无法在Windows主机上使用Ansible.
我的假设是正确的,还是我错过了什么?
我已成功安装Ansible(并随后运行一个剧本)到一个新的Vagrant来宾,使用以下bash脚本(使用Ubuntu 13.04测试):
#!/usr/bin/env bash export DEBIAN_FRONTEND=noninteractive apt-get update -qq apt-get install -y make git-core if [[ ! -d /home/vagrant/ansible ]]; then # Install Ansible dependencies. apt-get install -y python-MysqLdb python-yaml python-jinja2 python-paramiko sshpass # Checkout the Ansible repository. git clone https://github.com/ansible/ansible.git /home/vagrant/ansible mkdir /etc/ansible echo "localhost" > /etc/ansible/hosts source /home/vagrant/ansible/hacking/env-setup echo "source /home/vagrant/ansible/hacking/env-setup" >> /home/vagrant/.bashrc fi cd /srv/vagrant ansible-playbook playbook.yml