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"
|
echo "NE METTEZ PAS DE PASSPHRASE"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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 "effacement des containers existants"
|
||||||
echo "################################"
|
echo "################################"
|
||||||
docker stop $(docker ps -a -q)
|
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 "################################"
|
||||||
echo "Creation des network dockers pour le TP"
|
echo "Creation des network dockers pour le TP"
|
||||||
echo "################################"
|
echo "################################"
|
||||||
for x in $(seq 0 9); do docker network create --driver bridge brrock_n_$x ;done
|
for x in $(seq 0 4); 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 brddeb_n_$x ;done
|
||||||
echo "remise à zero de /root/.ssh/known_hosts"
|
echo "remise à zero de /root/.ssh/known_hosts"
|
||||||
echo "################################"
|
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 "supression des adresses des containers existants dans /etc/hosts"
|
||||||
echo "################################"
|
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
|
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 "Création des containers Debian 11 et rockylinux 8"
|
||||||
echo "################################"
|
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 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 ;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 "creation des ip des containers dans /etc/hosts"
|
||||||
echo "################################"
|
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}}' 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
|
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
|
sudo cat /tmp/hosts >> /etc/hosts
|
||||||
|
echo "" > ~/.ssh/known_hosts
|
||||||
#echo "installation depuis galaxy de la collection arista"
|
#echo "installation depuis galaxy de la collection arista"
|
||||||
#echo "installation de l'image ceos & aliasing routeur"
|
#echo "installation de l'image ceos & aliasing routeur"
|
||||||
#sudo ansible-galaxy collection install arista.eos
|
#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
|
debian
|
||||||
rocky
|
rocky
|
||||||
|
|
||||||
[arista]
|
|
||||||
ceos1 ansible_host=192.168.128.1
|
|
||||||
ceos2 ansible_host=192.168.128.2
|
|
||||||
ceos3 ansible_host=192.168.128.3
|
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
#!/bin/bas
|
#!/bin/bash
|
||||||
NC=`\033[m`
|
NC='\033[m'
|
||||||
Red=`\033[1;31m`
|
Red='\033[1;31m'
|
||||||
Blue=`\033[1;34m`
|
Blue='\033[1;34m'
|
||||||
|
|
||||||
if [ ! -f ~/.ssh/id_ed25519.pub ]
|
if [ ! -f ~/.ssh/id_ed25519.pub ]
|
||||||
then
|
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
|
exit 1
|
||||||
else
|
else
|
||||||
if [ $(id -u) -eq 0 ]
|
if [ $(id -u) -eq 0 ]
|
||||||
then
|
then
|
||||||
echo -e "$RedCe script doit être lancé en tant qu'utilisateur appartenant au groupe sudo$NC"
|
echo -e "$Red Ce script doit être lancé en tant qu'utilisateur appartenant au groupe sudo $NC"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo -e "$Red#################################################"
|
echo -e "$Red #################################################"
|
||||||
echo -e "Install packages"
|
echo -e "Install packages"
|
||||||
echo -e "#################################################$NC"
|
echo -e "################################################# $NC"
|
||||||
sudo apt install -y jupyter python3-virtualenv python3-setuptools build-essential libssl-dev libffi-dev python3-dev libkrb5-dev sshpass yamllint python3-pip apt-transport-https ca-certificates curl gnupg2 software-properties-common
|
sudo apt install -y jupyter python3-virtualenv python3-setuptools build-essential libssl-dev libffi-dev python3-dev libkrb5-dev sshpass yamllint python3-pip apt-transport-https ca-certificates curl gnupg2 software-properties-common
|
||||||
if [ ! -d /etc/ansible ]
|
if [ ! -d /etc/ansible ]
|
||||||
then
|
then
|
||||||
@ -42,15 +42,15 @@ pip3 install pywinrm[kerberos]
|
|||||||
pip3 install molecule[ansible,docker,lint]
|
pip3 install molecule[ansible,docker,lint]
|
||||||
# pip3 install docker
|
# pip3 install docker
|
||||||
pip3 install ansible-navigator[ansible-core]
|
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
|
# pip3 ensurepath
|
||||||
#source ~/.bashrc
|
#source ~/.bashrc
|
||||||
#source ~/.profile
|
#source ~/.profile
|
||||||
#ansible-galaxy collection install arista.eos
|
#ansible-galaxy collection install arista.eos
|
||||||
#ansible-galaxy collection install community.general
|
#ansible-galaxy collection install community.general
|
||||||
echo -e "$Red#################################################"
|
echo -e "$Red #################################################"
|
||||||
echo -e "Install docker-ce"
|
echo -e "Install docker-ce"
|
||||||
echo -e "#################################################$NC"
|
echo -e "################################################# $NC"
|
||||||
sudo curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
sudo curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||||
sudo echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
|
sudo echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
|
||||||
sudo apt update
|
sudo apt update
|
||||||
@ -58,8 +58,22 @@ sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose
|
|||||||
sudo systemctl enable docker
|
sudo systemctl enable docker
|
||||||
#sudo groupadd docker
|
#sudo groupadd docker
|
||||||
sudo usermod -a -G docker $USER
|
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 ~/.bashrc
|
||||||
source ~/.profile
|
source ~/.profile
|
||||||
echo -e "$Red#################################################"
|
echo -e "$Red #################################################"
|
||||||
echo -e "Veuillez vous déconnecter de votre session !"
|
echo -e "Veuillez vous déconnecter de votre session !"
|
||||||
echo -e "#################################################$NC"
|
echo -e "################################################# $NC"
|
||||||
|
|
||||||
|
6
ports.j2
6
ports.j2
@ -1,9 +1,9 @@
|
|||||||
Listen {{ansible_default_ipv4['address']}}:8080
|
Listen {{ ansible_default_ipv4['address'] }}:8080
|
||||||
|
|
||||||
<IfModule ssl_module>
|
<IfModule ssl_module>
|
||||||
Listen {{ansible_default_ipv4['address']}}:443
|
Listen {{ ansible_default_ipv4['address'] }}:443
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
||||||
<IfModule mod_gnutls.c>
|
<IfModule mod_gnutls.c>
|
||||||
Listen {{ansible_default_ipv4['address']}}:443
|
Listen {{ ansible_default_ipv4['address'] }}:443
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user