ajout Vgarantfile DNS pour bind9
This commit is contained in:
parent
16c177fa5b
commit
fc24e96ac6
@ -1,8 +1,9 @@
|
|||||||
# vagrant
|
# vagrant
|
||||||
|
|
||||||
le 2023-01-19
|
le 2023-01-29
|
||||||
|
|
||||||
Ce dépôt héberge des **Vagrantfile** dont
|
Ce dépôt héberge des **Vagrantfile** dont
|
||||||
|
* **dns** : Vagrantfile pour 2 serveurs **Bind9** (1 maitre et un esclave), tests **goss** chainés
|
||||||
* **docker**
|
* **docker**
|
||||||
* **docker-wordpress**
|
* **docker-wordpress**
|
||||||
* **docker-glpi**
|
* **docker-glpi**
|
||||||
|
53
dns/Vagrantfile
vendored
Normal file
53
dns/Vagrantfile
vendored
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# -*- mode: ruby -*-
|
||||||
|
# vi: set ft=ruby :
|
||||||
|
|
||||||
|
Vagrant.configure("2") do |config|
|
||||||
|
# Base VM OS configuration.
|
||||||
|
config.vm.box = "debian/bullseye64"
|
||||||
|
config.ssh.insert_key = false
|
||||||
|
config.vm.synced_folder '.', '/vagrant', disabled: true
|
||||||
|
|
||||||
|
# General VirtualBox VM configuration.
|
||||||
|
config.vm.provider :virtualbox do |v|
|
||||||
|
v.memory = 512
|
||||||
|
v.cpus = 1
|
||||||
|
v.linked_clone = true
|
||||||
|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
||||||
|
v.customize ["modifyvm", :id, "--ioapic", "on"]
|
||||||
|
end
|
||||||
|
|
||||||
|
# srv1 master.
|
||||||
|
config.vm.define "srv1" do |srv1|
|
||||||
|
srv1.vm.hostname = "srv1"
|
||||||
|
srv1.vm.network :private_network, ip: "192.168.56.10"
|
||||||
|
srv1.vm.provision "shell",
|
||||||
|
inline: "sudo apt-get update ; sudo apt-get install -y vim curl wget"
|
||||||
|
srv1.vm.provision "shell", path: "provision/setup-master.sh"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# srv2 slave.
|
||||||
|
config.vm.define "srv2" do |srv2|
|
||||||
|
srv2.vm.hostname = "srv2"
|
||||||
|
srv2.vm.network :private_network, ip: "192.168.56.11"
|
||||||
|
srv2.vm.provision "shell",
|
||||||
|
inline: "sudo apt-get update ; sudo apt-get install -y vim curl wget"
|
||||||
|
srv2.vm.provision "shell", path: "provision/setup-slave.sh"
|
||||||
|
end
|
||||||
|
|
||||||
|
# cli.
|
||||||
|
config.vm.define "cli" do |cli|
|
||||||
|
cli.vm.hostname = "cli"
|
||||||
|
cli.vm.network :private_network, ip: "192.168.56.30"
|
||||||
|
cli.vm.provider :virtualbox do |v|
|
||||||
|
v.customize ["modifyvm", :id, "--memory", 512]
|
||||||
|
end
|
||||||
|
cli.vm.provision "shell",
|
||||||
|
inline: "sudo apt-get update ; sudo apt-get install -y vim curl wget"
|
||||||
|
cli.vm.provision "ansible" do |ansible|
|
||||||
|
ansible.playbook = "provision/setup-cli.sh"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
28
dns/provision/setup-master.sh
Normal file
28
dns/provision/setup-master.sh
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
mondomaine=domaine.lan
|
||||||
|
apt-get install -y bind9 bind9-doc bind9-host
|
||||||
|
wget -nc https://gitea.lyc-lecastel.fr/gadmin/vagrant/raw/branch/main/divers/bind/mkzone
|
||||||
|
bash mkzone "${mondomaine}"
|
||||||
|
cp db.${mondomaine}* /etc/bind
|
||||||
|
cp named.conf.local /etc/bind
|
||||||
|
sudo named-checkconf /etc/bind/named.conf
|
||||||
|
sudo named-checkzone "${mondomaine}" "/etc/bind/db.${mondomaine}"
|
||||||
|
sudo systemctl restart bind9
|
||||||
|
host srv1
|
||||||
|
host srv2
|
||||||
|
host -t soa "${mondomaine}"
|
||||||
|
host -l "${mondomaine}"
|
||||||
|
curl -fsSL https://goss.rocks/install |sh
|
||||||
|
goss add command "host ${mondomaine}"
|
||||||
|
goss add command "host -t soa ${mondomaine}"
|
||||||
|
goss add command "host -t ns ${mondomaine}"
|
||||||
|
goss add command "host srv1.${mondomaine}"
|
||||||
|
goss add command "host srv1"
|
||||||
|
goss add command "host www"
|
||||||
|
goss add command "host srv2.${mondomaine}"
|
||||||
|
goss add command "host srv2"
|
||||||
|
goss add command "host 192.168.56.10"
|
||||||
|
goss add command "host 192.168.56.11"
|
||||||
|
goss v -f tap
|
15
dns/provision/setup-slave.sh
Normal file
15
dns/provision/setup-slave.sh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
mondomaine=domaine.lan
|
||||||
|
apt-get install -y bind9 bind9-doc bind9-host
|
||||||
|
wget -nc https://gitea.lyc-lecastel.fr/gadmin/vagrant/raw/branch/main/divers/bind/mkzone
|
||||||
|
bash mkzone -s "${mondomaine}"
|
||||||
|
cp named.conf.local /etc/bind
|
||||||
|
sudo named-checkconf /etc/bind/named.conf
|
||||||
|
sudo named-checkzone "${mondomaine}" "/etc/bind/db.${mondomaine}"
|
||||||
|
sudo systemctl restart bind9
|
||||||
|
host srv1
|
||||||
|
host srv2
|
||||||
|
host -t soa "${mondomaine}"
|
||||||
|
host -l "${mondomaine}"
|
Loading…
x
Reference in New Issue
Block a user