Vagrant-based testing environment #111

Merged
valberg merged 15 commits from vagrant into main 2022-11-25 13:07:10 +00:00
2 changed files with 28 additions and 29 deletions
Showing only changes of commit a67d82ad88 - Show all commits

39
Vagrantfile vendored
View file

@ -1,37 +1,36 @@
Vagrant.require_version ">= 1.7.0" Vagrant.require_version ">= 2.0.0"
PORT = 19022 PORT = 19022
Vagrant.configure(2) do |config| def provisioned?(vm="default", provider="virtualbox")
config.vm.network :forwarded_port, guest: PORT, host: PORT, id: "new_ssh" File.exist?(".vagrant/machines/#{vm}/#{provider}/action_provision")
# 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
end end
config.vm.define "datacoop" do |datacoop| Vagrant.configure(2) do |config|
datacoop.vm.box = "ubuntu/focal64" config.vm.network :private_network, ip: "192.168.56.10"
datacoop.vm.hostname = "datacoop" config.vm.network :forwarded_port, guest: PORT, host: PORT
datacoop.vm.provider "virtualbox" do |v| config.vm.box = "ubuntu/focal64"
config.vm.hostname = "datacoop"
config.vm.provider :virtualbox do |v|
v.memory = 4096 v.memory = 4096
end end
datacoop.vm.provision "ansible" do |ansible| config.vm.provision :ansible do |ansible|
ansible.compatibility_mode = "2.0" ansible.compatibility_mode = "2.0"
ansible.playbook = "playbook.yml" ansible.playbook = "playbook.yml"
ansible.ask_vault_pass = true ansible.ask_vault_pass = true
ansible.verbose = "v" ansible.verbose = "v"
ansible.extra_vars = {
base_domain: "datacoop.devel"
}
# If we are running the provision command, then we override the ansible_port # If the VM is already provisioned, we need to use the new port
if ARGV[0] == "provision" if provisioned?
ansible.host_vars = { config.ssh.guest_port = PORT
"datacoop" => { ansible.extra_vars = {
"ansible_port" => PORT ansible_port: PORT
}
} }
end end
end end
end end
end

View file

@ -30,6 +30,6 @@
- name: log in to registry - name: log in to registry
docker_login: docker_login:
registry: "{{ docker_registry.domain }}" registry: "docker.data.coop"
username: "docker" username: "docker"
password: "{{ docker_password }}" password: "{{ docker_password }}"