58 lines
1.0 KiB
Plaintext
58 lines
1.0 KiB
Plaintext
|
#!/bin/bash
|
||
|
# master: {{ vm_mastering }}
|
||
|
# edited: 2023-09-25
|
||
|
# updated: {{ ansible_date_time.date }}
|
||
|
|
||
|
doBuildSystem() {
|
||
|
echo "v{{ vm_mastering }}"
|
||
|
}
|
||
|
|
||
|
# Display introduction
|
||
|
doIntro() {
|
||
|
echo
|
||
|
echo "Docker Networks Managment: $HOSTNAME"
|
||
|
doBuildSystem
|
||
|
echo
|
||
|
}
|
||
|
|
||
|
# Show date/time header
|
||
|
doHeader() {
|
||
|
NOW=`date +"%Y/%m/%d %H:%M:%S"`
|
||
|
echo "- $NOW"
|
||
|
echo ""
|
||
|
}
|
||
|
|
||
|
if [ "$(id -u)" != "0" ]; then
|
||
|
doIntro
|
||
|
doHeader
|
||
|
echo
|
||
|
echo "This script must be run as root" 1>&2
|
||
|
echo
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
SELF=$(realpath $0)
|
||
|
SCRIPT=$(basename $SELF)
|
||
|
CWD=$(realpath $(pwd))
|
||
|
STACKS=$CWD
|
||
|
HOSTNAME=$(hostname)
|
||
|
|
||
|
cd $STACKS
|
||
|
|
||
|
doIntro
|
||
|
doHeader
|
||
|
|
||
|
if [ "$HOSTNAME" == "{{ vm_main_name }}" ]; then
|
||
|
echo " - Create Traefik Network"
|
||
|
docker network create \
|
||
|
--attachable \
|
||
|
--driver bridge \
|
||
|
--ipv6 \
|
||
|
--opt "com.docker.network.bridge.name={{ vm_docker_traefik_network }}" \
|
||
|
--opt "com.docker.network.driver.mtu=1500" \
|
||
|
traefik
|
||
|
else
|
||
|
echo " - Only for use on {{ vm_main_name }} !!!"
|
||
|
fi
|
||
|
|
||
|
exit 0
|