Compare commits
10 Commits
145c2c8dc3
...
0224bd9047
Author | SHA1 | Date | |
---|---|---|---|
0224bd9047 | |||
8e393ff584 | |||
41d084057a | |||
9299286942 | |||
c93bb03ffd | |||
64d0242a03 | |||
1393f91c6a | |||
d60ddcfc70 | |||
b5d92f7daf | |||
ebc2500ea2 |
@ -6,7 +6,7 @@ then
|
||||
echo "NE METTEZ PAS DE PASSPHRASE"
|
||||
exit 1
|
||||
fi
|
||||
sudo cat ~/.ssh/id_ed25519.pub >> /root/.ssh/authorized_keys
|
||||
cat ~/.ssh/id_ed25519.pub | sudo tee -a /root/.ssh/authorized_keys
|
||||
echo "effacement des containers existants"
|
||||
echo "################################"
|
||||
docker stop $(docker ps -a -q)
|
||||
@ -19,23 +19,24 @@ for net in $(docker network ls -q); do docker network rm $net; done
|
||||
echo "################################"
|
||||
echo "Creation des network dockers pour le TP"
|
||||
echo "################################"
|
||||
for x in $(seq 0 9); do docker network create --driver bridge brrock_n_$x ;done
|
||||
for x in $(seq 0 9); do docker network create --driver bridge brddeb_n_$x ;done
|
||||
for x in $(seq 0 4); do docker network create --driver bridge brrock_n_$x ;done
|
||||
for x in $(seq 0 4); do docker network create --driver bridge brddeb_n_$x ;done
|
||||
echo "remise à zero de /root/.ssh/known_hosts"
|
||||
echo "################################"
|
||||
sudo echo "" > /root/.ssh/known_host
|
||||
echo "" | sudo tee /root/.ssh/known_host
|
||||
echo "supression des adresses des containers existants dans /etc/hosts"
|
||||
echo "################################"
|
||||
awk -v opt="i" -v lineNo="6" 'NR > lineNo-( opt == "i"? 1 : 0 ){exit};1' /etc/hosts > /tmp/hosts && sudo mv /tmp/hosts /etc/hosts
|
||||
echo "Création des containers Debian 11 et rockylinux 8"
|
||||
echo "################################"
|
||||
for x in $(seq 0 4); do docker run -d -p 322$x:22 -v /root/.ssh:/root/.ssh --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --net brrock_n_$x --name rocky-$x --hostname rocky-$x registry.iut-kourou.local/rockylinux-ssh:8 ;done
|
||||
for x in $(seq 0 4); do docker run -d -p 222$x:22 -v /root/.ssh:/root/.ssh --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --net brddeb_n_$x --name debian-$x --hostname debian-$x registry.iut-kourou.local/debian-ssh:11 ;done
|
||||
for x in $(seq 0 4); do docker run -d -p 322$x:22 -v /root/.ssh:/root/.ssh --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --net brrock_n_$x --name rocky-$x --hostname rocky-$x registry.iut-kourou.local/rockylinux-ssh:8.03 ;done
|
||||
for x in $(seq 0 4); do docker run -d -p 222$x:22 -v /root/.ssh:/root/.ssh --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --net brddeb_n_$x --name debian-$x --hostname debian-$x registry.iut-kourou.local/debian-ssh:11.02 ;done
|
||||
echo "creation des ip des containers dans /etc/hosts"
|
||||
echo "################################"
|
||||
for x in $(seq 0 4); do echo "$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' rocky-$x) rocky-$x" >> /tmp/hosts;done
|
||||
for x in $(seq 0 4); do echo "$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' debian-$x) debian-$x" >> /tmp/hosts;done
|
||||
sudo cat /tmp/hosts >> /etc/hosts
|
||||
echo "" > ~/.ssh/known_hosts
|
||||
#echo "installation depuis galaxy de la collection arista"
|
||||
#echo "installation de l'image ceos & aliasing routeur"
|
||||
#sudo ansible-galaxy collection install arista.eos
|
||||
|
4
hosts
4
hosts
@ -16,7 +16,3 @@ rocky-4 ansible_host=127.0.0.1 ansible_ssh_private_key_file=~/.ssh/id_ed25519 an
|
||||
debian
|
||||
rocky
|
||||
|
||||
[arista]
|
||||
ceos1 ansible_host=192.168.128.1
|
||||
ceos2 ansible_host=192.168.128.2
|
||||
ceos3 ansible_host=192.168.128.3
|
||||
|
@ -1,11 +1,11 @@
|
||||
#!/bin/bas
|
||||
NC=`\033[m`
|
||||
Red=`\033[1;31m`
|
||||
Blue=`\033[1;34m`
|
||||
#!/bin/bash
|
||||
NC='\033[m'
|
||||
Red='\033[1;31m'
|
||||
Blue='\033[1;34m'
|
||||
|
||||
if [ ! -f ~/.ssh/id_ed25519.pub ]
|
||||
then
|
||||
echo -e '$REDVeuillez créer une clé assymétrique ssh !$NC'
|
||||
echo -e "$Red Veuillez créer une clé assymétrique ssh ! $NC"
|
||||
exit 1
|
||||
else
|
||||
if [ $(id -u) -eq 0 ]
|
||||
@ -42,7 +42,7 @@ pip3 install pywinrm[kerberos]
|
||||
pip3 install molecule[ansible,docker,lint]
|
||||
# pip3 install docker
|
||||
pip3 install ansible-navigator[ansible-core]
|
||||
pip3 install --upgrade git+https://github.com/networkop/docker-topo.git
|
||||
#pip3 install --upgrade git+https://github.com/networkop/docker-topo.git
|
||||
# pip3 ensurepath
|
||||
#source ~/.bashrc
|
||||
#source ~/.profile
|
||||
@ -58,8 +58,22 @@ sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose
|
||||
sudo systemctl enable docker
|
||||
#sudo groupadd docker
|
||||
sudo usermod -a -G docker $USER
|
||||
#Autoriser les serveur registry local en http
|
||||
if [ ! -f /etc/docker/daemon.json ]
|
||||
then
|
||||
sudo tee -a /etc/docker/daemon.json << 'EOF'
|
||||
{
|
||||
"insecure-registries": [
|
||||
"registry.iut-kourou.local"
|
||||
]
|
||||
}
|
||||
EOF
|
||||
sudo systemctl restart docker
|
||||
fi
|
||||
|
||||
source ~/.bashrc
|
||||
source ~/.profile
|
||||
echo -e "$Red #################################################"
|
||||
echo -e "Veuillez vous déconnecter de votre session !"
|
||||
echo -e "################################################# $NC"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user