首页 > 代码库 > 在WINDOWS上通过VAGRANT练习ANSIBLE

在WINDOWS上通过VAGRANT练习ANSIBLE

有点曲折,但没办法,还要通过VAGRANT里的ANSIBLE建DOCKER呢。。

VagrantFile

# -*- mode: ruby -*-# vi: set ft=ruby :Vagrant.configure(2) do |config|  config.vm.box = "ubuntu/trusty64"  if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil    config.vm.synced_folder ".", "/vagrant", mount_options: ["dmode=700,fmode=600"]  else    config.vm.synced_folder ".", "/vagrant"  end  config.vm.provider "virtualbox" do |v|    v.memory = 2048  end  config.vm.define :dev do |dev|    dev.vm.network "private_network", ip: "10.100.199.200"    dev.vm.provision :shell, path: "bootstrap.sh"  end  if Vagrant.has_plugin?("vagrant-cachier")    config.cache.scope = :box  end  if Vagrant.has_plugin?("vagrant-vbguest")    config.vbguest.auto_update = false    config.vbguest.no_install = true    config.vbguest.no_remote = true  endend

bootstrap.sh

#!/bin/bashecho "Installing Ansible..."apt-get install -y software-properties-commonapt-add-repository ppa:ansible/ansibleapt-get update apt-get install -y --force-yes ansible

ansible hosts:

[local]127.0.0.1 ansible_ssh_pass=vagrant ansible_ssh_user=vagrant

技术分享

在WINDOWS上通过VAGRANT练习ANSIBLE