Scripte zum Erzeugen des Inventory
This commit is contained in:
parent
cf354508fd
commit
9078900dd1
15
helper/create_hosts_from_file.sh
Executable file
15
helper/create_hosts_from_file.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" -o ! -f "$1" ]; then
|
||||
echo Need filename
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for GROUP in alpine archlinux centos debian devuan fedora oracle opensuse ubuntu voidlinux
|
||||
do
|
||||
grep "${GROUP}" "$1" | while read NAME IP REST
|
||||
do
|
||||
echo -e "${IP}\t${NAME}.heinlein.akademie\t\t${NAME}"
|
||||
done
|
||||
done
|
||||
|
10
helper/create_hosts_from_lxc.sh
Executable file
10
helper/create_hosts_from_lxc.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
for GROUP in alpine archlinux centos debian devuan fedora oracle opensuse ubuntu voidlinux
|
||||
do
|
||||
sudo lxc-ls -f -F name,ipv4 -g ${GROUP} | grep -v NAME | while read NAME IP
|
||||
do
|
||||
echo -e "${IP}\t${NAME}.heinlein.akademie\t\t${NAME}"
|
||||
done
|
||||
done
|
||||
|
90
helper/create_inventory_from_file.sh
Executable file
90
helper/create_inventory_from_file.sh
Executable file
|
@ -0,0 +1,90 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" -o ! -f "$1" ]; then
|
||||
echo Need filename
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for GROUP in almalinux alpine archlinux centos debian devuan fedora oracle rockylinux opensuse ubuntu voidlinux
|
||||
do
|
||||
echo "[${GROUP}]"
|
||||
grep "${GROUP}" "$1" | while read NAME IP REST
|
||||
do
|
||||
case "${GROUP}" in
|
||||
almalinux|rockylinux)
|
||||
echo -e "${NAME}\t\tansible_host=${IP}"
|
||||
;;
|
||||
*)
|
||||
echo "${NAME}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
echo ""
|
||||
done
|
||||
|
||||
|
||||
cat <<EOF
|
||||
############################################################
|
||||
|
||||
[apk:children]
|
||||
alpine
|
||||
|
||||
[apt]
|
||||
EOF
|
||||
|
||||
grep "mint" "$1" | while read NAME IP REST
|
||||
do
|
||||
echo "${NAME}"
|
||||
done
|
||||
|
||||
cat <<EOF
|
||||
|
||||
[apt:children]
|
||||
debian
|
||||
devuan
|
||||
ubuntu
|
||||
|
||||
[pacman:children]
|
||||
archlinux
|
||||
|
||||
[yum:children]
|
||||
almalinux
|
||||
centos
|
||||
fedora
|
||||
oracle
|
||||
rockylinux
|
||||
|
||||
[xbps:children]
|
||||
voidlinux
|
||||
|
||||
[zypper:children]
|
||||
opensuse
|
||||
|
||||
############################################################
|
||||
|
||||
[lb]
|
||||
tn00-alpine3j
|
||||
tn00-alpine3k
|
||||
|
||||
[lb:vars]
|
||||
ansible_ssh_transfer_method=piped
|
||||
|
||||
[worker]
|
||||
tn00-ubu2004a
|
||||
tn00-ubu2004b
|
||||
tn00-ubu2004c
|
||||
tn00-ubu2004d
|
||||
|
||||
tn00-debian11
|
||||
|
||||
[db]
|
||||
tn00-ubu2004a
|
||||
tn00-ubu2004b
|
||||
|
||||
[webcluster:children]
|
||||
lb
|
||||
worker
|
||||
db
|
||||
|
||||
EOF
|
||||
|
85
helper/create_inventory_from_lxc.sh
Executable file
85
helper/create_inventory_from_lxc.sh
Executable file
|
@ -0,0 +1,85 @@
|
|||
#!/bin/bash
|
||||
|
||||
for GROUP in almalinux alpine archlinux centos debian devuan fedora oracle rockylinux opensuse ubuntu voidlinux
|
||||
do
|
||||
echo "[${GROUP}]"
|
||||
sudo lxc-ls -f -F name,ipv4 -g ${GROUP} | grep -v NAME | while read NAME IP
|
||||
do
|
||||
case "${GROUP}" in
|
||||
almalinux|rockylinux)
|
||||
echo -e "${NAME}\t\tansible_host=${IP}"
|
||||
;;
|
||||
*)
|
||||
echo "${NAME}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
echo ""
|
||||
done
|
||||
|
||||
|
||||
cat <<EOF
|
||||
############################################################
|
||||
|
||||
[apk:children]
|
||||
alpine
|
||||
|
||||
[apt]
|
||||
EOF
|
||||
|
||||
sudo lxc-ls -f -F name,ipv4 -g mint | grep -v NAME | while read NAME IP
|
||||
do
|
||||
echo "${NAME}"
|
||||
done
|
||||
|
||||
cat <<EOF
|
||||
|
||||
[apt:children]
|
||||
debian
|
||||
devuan
|
||||
ubuntu
|
||||
|
||||
[pacman:children]
|
||||
archlinux
|
||||
|
||||
[yum:children]
|
||||
almalinux
|
||||
centos
|
||||
fedora
|
||||
oracle
|
||||
rockylinux
|
||||
|
||||
[xbps:children]
|
||||
voidlinux
|
||||
|
||||
[zypper:children]
|
||||
opensuse
|
||||
|
||||
############################################################
|
||||
|
||||
[lb]
|
||||
tn00-alpine3j
|
||||
tn00-alpine3k
|
||||
|
||||
[lb:vars]
|
||||
ansible_ssh_transfer_method=piped
|
||||
|
||||
[worker]
|
||||
tn00-ubu2004a
|
||||
tn00-ubu2004b
|
||||
tn00-ubu2004c
|
||||
tn00-ubu2004d
|
||||
|
||||
tn00-debian11
|
||||
|
||||
[db]
|
||||
tn00-ubu2004a
|
||||
tn00-ubu2004b
|
||||
|
||||
[webcluster:children]
|
||||
lb
|
||||
worker
|
||||
db
|
||||
|
||||
EOF
|
||||
|
Loading…
Reference in a new issue