ansible-public/test/Vagrantfile
Jérémy Lecour b8d0a571a7
amélioration des définitions de VM dans Vagrant
* on fait un "apt update" systématique, au cas où on ne jouerait pas le rôle "evolinux-base"
* configuration en ELTS pour Jessie et Stretch
* suppression de Squeeze (plus de box Vagrant dispo)
2024-01-18 10:11:18 +01:00

180 lines
4.9 KiB
Ruby

# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.synced_folder "./vagrant_share/", "/vagrant", disabled: true
config.vm.network "forwarded_port", guest: 80, host: 8080, auto_correct: true
# config.vm.provider :virtualbox do |v|
# v.memory = 1024
# v.cpus = 1
# v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
# v.customize ["modifyvm", :id, "--ioapic", "on"]
# end
config.vm.provider :libvirt do |libvirt|
# libvirt.storage :file, :size => '10G', :device => 'vdb'
libvirt.memory = 1024
libvirt.cpus = 1
end
elts_script = <<~SCRIPT
echo "" > /etc/apt/sources.list
echo "" > /etc/apt/sources.list.d/extended-lts.list
echo "deb http://elts.evolix.org/extended-lts $(lsb_release --codename --short) main" >> /etc/apt/sources.list.d/extended-lts.list
echo "deb http://elts.evolix.org/extended-lts $(lsb_release --codename --short)-lts main" >> /etc/apt/sources.list.d/extended-lts.list
wget --no-check-certificate https://deb.freexian.com/extended-lts/archive-key.gpg -O /etc/apt/trusted.gpg.d/freexian-archive-extended-lts.gpg
chmod 644 /etc/apt/trusted.gpg.d/freexian-archive-extended-lts.gpg
DEBIAN_FRONTEND=noninteractive apt-get --quiet update
SCRIPT
# Bookworm
config.vm.define :bookworm do |node|
node.vm.hostname = "bookworm.evolix.net"
node.vm.box = "debian/bookworm64"
node.vm.provision "apt update", type: "shell", inline: "apt update"
node.vm.provision :ansible do |ansible|
ansible.limit = "bookworm"
ansible.playbook = "vagrant.yml"
# ansible.tags = "mysql"
ansible.raw_arguments = [
"-b",
"--ask-vault-pass",
# "--diff",
# "--step",
# "--syntax",
# "-vvv",
]
ansible.extra_vars = {
ansible_python_interpreter: "/usr/bin/python3"
}
end
end
# Bullseye
config.vm.define :bullseye do |node|
node.vm.hostname = "bullseye.evolix.net"
node.vm.box = "debian/bullseye64"
node.vm.provision "apt update", type: "shell", inline: "apt update"
node.vm.provision :ansible do |ansible|
ansible.limit = "bullseye"
ansible.playbook = "vagrant.yml"
# ansible.tags = "mysql"
ansible.raw_arguments = [
"-b",
"--ask-vault-pass",
# "--diff",
# "--step",
# "--syntax",
# "-vvv",
]
ansible.extra_vars = {
ansible_python_interpreter: "/usr/bin/python3"
}
end
end
# Buster
config.vm.define :buster do |node|
node.vm.hostname = "buster"
node.vm.box = "debian/buster64"
node.vm.provision "apt update", type: "shell", inline: "apt update"
node.vm.provision :ansible do |ansible|
ansible.limit = "buster"
ansible.playbook = "vagrant.yml"
# ansible.tags = "mysql"
ansible.raw_arguments = [
"-b",
"--ask-vault-pass",
# "--diff",
# "--step",
# "--syntax",
# "-vvv",
]
end
end
# Stretch
config.vm.define :stretch do |node|
node.vm.hostname = "stretch"
node.vm.box = "debian/stretch64"
node.vm.provision "elts", type: "shell", inline: elts_script
node.vm.provision "apt update", type: "shell", inline: "apt update"
node.vm.provision :ansible do |ansible|
ansible.limit = "stretch"
ansible.playbook = "vagrant.yml"
# ansible.tags = "mysql"
ansible.raw_arguments = [
"-b",
"--ask-vault-pass",
# "--diff",
# "--step",
# "--syntax",
# "-vvv",
]
end
end
old_ssh_options = [
"-o HostKeyAlgorithms=+ssh-rsa",
"-o PubkeyAcceptedKeyTypes=+ssh-rsa"
]
# Jessie
config.vm.define :jessie do |node|
node.vm.hostname = "jessie"
node.vm.box = "debian/jessie64"
node.ssh.extra_args = old_ssh_options
node.vm.provision "elts", type: "shell", inline: elts_script
node.vm.provision "apt update", type: "shell", inline: "apt update"
node.vm.provision :ansible do |ansible|
ansible.limit = "jessie"
ansible.playbook = "vagrant.yml"
# ansible.tags = "mysql"
ansible.raw_ssh_args = old_ssh_options
ansible.raw_arguments = [
"-b",
"--ask-vault-pass",
# "--diff",
# "--step",
# "--syntax",
# "-vvv",
]
end
end
# # Squeeze
# config.vm.define :squeeze do |node|
# node.vm.hostname = "squeeze"
# node.vm.box = "debian/squeeze64"
# node.ssh.extra_args = old_ssh_options
# node.vm.provision :ansible do |ansible|
# ansible.limit = "squeeze"
# ansible.playbook = "vagrant.yml"
# # ansible.tags = "mysql"
# ansible.raw_ssh_args = old_ssh_options
# ansible.raw_arguments = [
# "-b",
# "--ask-vault-pass",
# # "--diff",
# # "--step",
# # "--syntax",
# # "-vvv",
# ]
# end
# end
end