Vagrant-based testing environment #111
55
Vagrantfile
vendored
55
Vagrantfile
vendored
|
@ -1,37 +1,36 @@
|
|||
Vagrant.require_version ">= 1.7.0"
|
||||
|
||||
Vagrant.require_version ">= 2.0.0"
|
||||
PORT = 19022
|
||||
|
||||
Vagrant.configure(2) do |config|
|
||||
config.vm.network :forwarded_port, guest: PORT, host: PORT, id: "new_ssh"
|
||||
def provisioned?(vm="default", provider="virtualbox")
|
||||
File.exist?(".vagrant/machines/#{vm}/#{provider}/action_provision")
|
||||
end
|
||||
|
||||
# If we are trying to SSH into the VM, we need to use the new port
|
||||
if ARGV[0] == "ssh"
|
||||
config.ssh.guest_port = PORT
|
||||
Vagrant.configure(2) do |config|
|
||||
config.vm.network :private_network, ip: "192.168.56.10"
|
||||
config.vm.network :forwarded_port, guest: PORT, host: PORT
|
||||
|
||||
config.vm.box = "ubuntu/focal64"
|
||||
config.vm.hostname = "datacoop"
|
||||
|
||||
config.vm.provider :virtualbox do |v|
|
||||
v.memory = 4096
|
||||
end
|
||||
|
||||
config.vm.define "datacoop" do |datacoop|
|
||||
datacoop.vm.box = "ubuntu/focal64"
|
||||
datacoop.vm.hostname = "datacoop"
|
||||
config.vm.provision :ansible do |ansible|
|
||||
ansible.compatibility_mode = "2.0"
|
||||
ansible.playbook = "playbook.yml"
|
||||
ansible.ask_vault_pass = true
|
||||
ansible.verbose = "v"
|
||||
ansible.extra_vars = {
|
||||
base_domain: "datacoop.devel"
|
||||
}
|
||||
|
||||
datacoop.vm.provider "virtualbox" do |v|
|
||||
v.memory = 4096
|
||||
end
|
||||
|
||||
datacoop.vm.provision "ansible" do |ansible|
|
||||
ansible.compatibility_mode = "2.0"
|
||||
ansible.playbook = "playbook.yml"
|
||||
ansible.ask_vault_pass = true
|
||||
ansible.verbose = "v"
|
||||
|
||||
# If we are running the provision command, then we override the ansible_port
|
||||
if ARGV[0] == "provision"
|
||||
ansible.host_vars = {
|
||||
"datacoop" => {
|
||||
"ansible_port" => PORT
|
||||
}
|
||||
}
|
||||
end
|
||||
# If the VM is already provisioned, we need to use the new port
|
||||
if provisioned?
|
||||
config.ssh.guest_port = PORT
|
||||
ansible.extra_vars = {
|
||||
ansible_port: PORT
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,6 +30,6 @@
|
|||
|
||||
- name: log in to registry
|
||||
docker_login:
|
||||
registry: "{{ docker_registry.domain }}"
|
||||
registry: "docker.data.coop"
|
||||
username: "docker"
|
||||
password: "{{ docker_password }}"
|
||||
|
|
Loading…
Reference in a new issue