mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-10 17:04:01 +02:00
vagrant & ansible scripts added inc docs in README
This commit is contained in:
59
Vagrantfile
vendored
Executable file
59
Vagrantfile
vendored
Executable file
@@ -0,0 +1,59 @@
|
||||
##################################################
|
||||
# Generated by phansible.com
|
||||
##################################################
|
||||
|
||||
#If your Vagrant version is lower than 1.5, you can still use this provisioning
|
||||
#by commenting or removing the line below and providing the config.vm.box_url parameter,
|
||||
#if it's not already defined in this Vagrantfile. Keep in mind that you won't be able
|
||||
#to use the Vagrant Cloud and other newer Vagrant features.
|
||||
Vagrant.require_version ">= 1.5"
|
||||
|
||||
# Check to determine whether we're on a windows or linux/os-x host,
|
||||
# later on we use this to launch ansible in the supported way
|
||||
# source: https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
|
||||
def which(cmd)
|
||||
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
||||
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
||||
exts.each { |ext|
|
||||
exe = File.join(path, "#{cmd}#{ext}")
|
||||
return exe if File.executable? exe
|
||||
}
|
||||
end
|
||||
return nil
|
||||
end
|
||||
Vagrant.configure("2") do |config|
|
||||
|
||||
config.vm.provider :virtualbox do |v|
|
||||
v.name = "design-patterns"
|
||||
v.customize [
|
||||
"modifyvm", :id,
|
||||
"--name", "design-patterns",
|
||||
"--memory", 512,
|
||||
"--natdnshostresolver1", "on",
|
||||
"--cpus", 1,
|
||||
]
|
||||
end
|
||||
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
|
||||
config.vm.network :private_network, ip: "192.168.11.2"
|
||||
config.ssh.forward_agent = true
|
||||
|
||||
#############################################################
|
||||
# Ansible provisioning (you need to have ansible installed)
|
||||
#############################################################
|
||||
|
||||
|
||||
if which('ansible-playbook')
|
||||
config.vm.provision "ansible" do |ansible|
|
||||
ansible.playbook = "ansible/playbook.yml"
|
||||
ansible.inventory_path = "ansible/inventories/dev"
|
||||
ansible.limit = 'all'
|
||||
end
|
||||
else
|
||||
config.vm.provision :shell, path: "ansible/windows.sh", args: ["default"]
|
||||
end
|
||||
|
||||
|
||||
config.vm.synced_folder "./", "/vagrant", type: "nfs"
|
||||
end
|
Reference in New Issue
Block a user