Client Installation: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
HK (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
HK (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
| Zeile 1: | Zeile 1: | ||
= MACs der Client-PCs finden = | |||
* Ziel: Erkennen und Einbinden neuer Clients. | |||
** Automatisiert wird: | |||
*** /etc/dhcp/dhcpd.conf schreiben | |||
*** OPSI-Client hinzufügen | |||
*** OPSI-Client mit Software versorgen | |||
In diesem HowTo wird TinyCore eingesetzt.<br> | In diesem HowTo wird TinyCore eingesetzt.<br> | ||
Der große Vorteil liegt im per default eingesetzten dhcp-Clienten, der ein gebootetes TinyCore automatisch mit einer IP versorgt.<br> | Der große Vorteil liegt im per default eingesetzten dhcp-Clienten, der ein gebootetes TinyCore automatisch mit einer IP versorgt.<br> | ||
== Auf CentOS == | == Auf CentOS == | ||
=== Notwendige Pakete === | === Notwendige Pakete === | ||
yum install -y syslinux-tftpboot nmap | yum install -y syslinux-tftpboot nmap | ||
| Zeile 50: | Zeile 55: | ||
Für den '''detect mode''' den '''range''' und den '''filename''' in der dhcpd.conf umschalten. | Für den '''detect mode''' den '''range''' und den '''filename''' in der dhcpd.conf umschalten. | ||
systemctl restart dhcpd.service | systemctl restart dhcpd.service | ||
== Scripte == | |||
=== delete-host <HOSTNAME> === | |||
#!/bin/bash | |||
__HOST=$1 | |||
__FQDN=$__HOST.$(hostname -d) | |||
__DHCPD_CONFIG=/etc/dhcp/dhcpd.conf | |||
echo "Deleting $__FQDN from OPSI and dhcpd.conf" | |||
opsi-admin -d method deleteClient $__FQDN | |||
sed -i "s#$(grep $__FQDN $__DHCPD_CONFIG)#$(grep $__FQDN $__DHCPD_CONFIG | sed "s#\([0-9A-Z][0-9A-Z]:\)\{5\}[0-9A-Z][0-9A-Z]#00:00:00:00:00:00#")#" $__DHCPD_CONFIG | |||
=== detect-setup === | |||
#!/bin/bash | |||
# __PKGS sourcen aus ~/bin/PKGS.conf | |||
# Example: __PKGS="win7 cool-software uncool-software" | |||
if [ -f ~/bin/PKGS.conf ] | |||
then | |||
. ~/bin/PKGS.conf | |||
else | |||
echo "Pakage config ist missing" | |||
fi | |||
__NETWORK=<NETWORK>/24 | |||
__DHCPD_CONF=/etc/dhcp/dhcpd.conf | |||
__MAC="" | |||
__HOSTNAME="" | |||
__DOMAIN=$(hostname -d) | |||
if [ -d new_clients ] | |||
then | |||
echo "new_clients exists" | |||
exit | |||
else | |||
mkdir new_clients | |||
fi | |||
cp -a $__DHCPD_CONF $__DHCPD_CONF-$(date +%Y-%m-%d_%H-%M) | |||
for __MAC in $(nmap -n -sP $__NETWORK |grep MAC|awk '{print $3}') | |||
do | |||
# Setup dhcpd.conf | |||
echo $__MAC | |||
sed -i "0,/00:00:00:00:00:00/s//$__MAC/" $__DHCPD_CONF | |||
# grep new Hostname | |||
__HOSTNAME=$(grep $__MAC $__DHCPD_CONF |grep -oE win[0-9]*[0-9][0-9].$__DOMAIN|cut -d. -f1) | |||
echo $__HOSTNAME | |||
touch new_clients/$__HOSTNAME | |||
# Create new OPSI-Client | |||
__FQDN=$__HOSTNAME.$__DOMAIN | |||
opsi-admin -d method createClient "${$__HOSTNAME}" "${$__DOMAIN}" | |||
opsi-admin -d method setMacAddress "${$__FQDN}" "${$__MAC}" | |||
# Setup software for new Client | |||
for __PKG in $__PKGS | |||
do | |||
opsi-admin -d method setProductActionRequest $__PKG "${__FQDN}" setup | |||
done | |||
done | |||
Version vom 8. April 2015, 14:40 Uhr
MACs der Client-PCs finden
- Ziel: Erkennen und Einbinden neuer Clients.
- Automatisiert wird:
- /etc/dhcp/dhcpd.conf schreiben
- OPSI-Client hinzufügen
- OPSI-Client mit Software versorgen
- Automatisiert wird:
In diesem HowTo wird TinyCore eingesetzt.
Der große Vorteil liegt im per default eingesetzten dhcp-Clienten, der ein gebootetes TinyCore automatisch mit einer IP versorgt.
Auf CentOS
Notwendige Pakete
yum install -y syslinux-tftpboot nmap
Struktur erstellen
mkdir -p /tftpboot/detect/tinycore-hd mkdir /tftpboot/detect/pxelinux.cfg
cp -v /usr/share/syslinux/pxelinux.0 . cp -v /usr/share/syslinux/memdisk .
tinycore
wget http://tinycorelinux.net/5.x/x86/release/Core-current.iso -O /tftpboot/detect/core.iso mount -o loop core.iso /mnt cp -a /mnt/* /tftpboot/detect/tinycore-hd
tinycore notizen
- openssh
Besteht aus:
gcc_libs.tcz openssl-1.0.0.tcz openssh.tcz
/tftpboot/detect/pxelinux.cfg/default
vim /tftpboot/detect/pxelinux.cfg/default
default core label core kernel tinycore-hd/boot/vmlinuz append initrd=tinycore-hd/boot/core.gz
/etc/dhcp/dhcpd.conf
vim /etc/dhcp/dhcpd.conf
- Einfügen
# Global # filename detect # filename "detect/pxelinux.0"; # in der subnet definition #range detect # range <sehr großer range>;
Für den detect mode den range und den filename in der dhcpd.conf umschalten.
systemctl restart dhcpd.service
Scripte
delete-host <HOSTNAME>
#!/bin/bash
__HOST=$1
__FQDN=$__HOST.$(hostname -d)
__DHCPD_CONFIG=/etc/dhcp/dhcpd.conf
echo "Deleting $__FQDN from OPSI and dhcpd.conf"
opsi-admin -d method deleteClient $__FQDN
sed -i "s#$(grep $__FQDN $__DHCPD_CONFIG)#$(grep $__FQDN $__DHCPD_CONFIG | sed "s#\([0-9A-Z][0-9A-Z]:\)\{5\}[0-9A-Z][0-9A-Z]#00:00:00:00:00:00#")#" $__DHCPD_CONFIG
detect-setup
#!/bin/bash
# __PKGS sourcen aus ~/bin/PKGS.conf
# Example: __PKGS="win7 cool-software uncool-software"
if [ -f ~/bin/PKGS.conf ]
then
. ~/bin/PKGS.conf
else
echo "Pakage config ist missing"
fi
__NETWORK=<NETWORK>/24
__DHCPD_CONF=/etc/dhcp/dhcpd.conf
__MAC=""
__HOSTNAME=""
__DOMAIN=$(hostname -d)
if [ -d new_clients ]
then
echo "new_clients exists"
exit
else
mkdir new_clients
fi
cp -a $__DHCPD_CONF $__DHCPD_CONF-$(date +%Y-%m-%d_%H-%M)
for __MAC in $(nmap -n -sP $__NETWORK |grep MAC|awk '{print $3}')
do
# Setup dhcpd.conf
echo $__MAC
sed -i "0,/00:00:00:00:00:00/s//$__MAC/" $__DHCPD_CONF
# grep new Hostname
__HOSTNAME=$(grep $__MAC $__DHCPD_CONF |grep -oE win[0-9]*[0-9][0-9].$__DOMAIN|cut -d. -f1)
echo $__HOSTNAME
touch new_clients/$__HOSTNAME
# Create new OPSI-Client
__FQDN=$__HOSTNAME.$__DOMAIN
opsi-admin -d method createClient "${$__HOSTNAME}" "${$__DOMAIN}"
opsi-admin -d method setMacAddress "${$__FQDN}" "${$__MAC}"
# Setup software for new Client
for __PKG in $__PKGS
do
opsi-admin -d method setProductActionRequest $__PKG "${__FQDN}" setup
done
done