加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

是否可以在Windows主机上执行Vagrant Ansible配置程序?

发布时间:2020-12-14 00:22:21 所属栏目:Windows 来源:网络整理
导读:似乎Vagrant不允许我使用Vmware在 Windows上自动配置Ansible配置器. 我不确定Ansible是否必须安装在主机上(在我的情况下是Windows)或客户机上. 我尝试使用以下shell脚本自动配置来宾计算机: #!/usr/bin/env bashapt-get update -yapt-get install openssh-c
似乎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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读