{{tag>Brouillon VM Déploiement}} # Cobbler déploiement Ubuntu ou Debian Voir : * [[Notes cobbler]] * http://backdrift.org/ubuntu-lucid-10-04-cobbler-kickstart-setup-how-to Notes : Nous n'utiliserons pas debmirror \\ Contexte : Nous sommmes sur une CentOS7 (Serveur Cobbler) et nous allons déployer une Ubuntu Server 16.04 Mise-à-jour de la liste des signatures (--os-version) ~~~bash cobbler signature update ~~~ Import de l'ISO montée sur /mnt ~~~bash mount ubuntu-16.04-server-amd64.iso /mnt cobbler import --name=ubuntu-server --path=/mnt --breed=ubuntu --os-version=xenial --arch=x86_64 umount /mnt ~~~ Copie du profile original ~~~bash cobbler profile copy --name=ubuntu-server-x86_64 --newname=ubuntu-server-16.04.vm ~~~ Modif du nouveau profile ~~~bash cobbler profile edit --name=ubuntu-server-16.04.vm --proxy=http://192.168.100.3:8080/ --virt-path=/var/lib/libvirt/images ~~~ Modif du nouveau profile (pour `visrsh console` et autre) ~~~bash cobbler profile edit --name=ubuntu-server-16.04.vm --kopts-post="console=ttyS0,115200n8 ipv6.disable=1 vga=0x317" --kopts="console=ttyS0,115200n8 ipv6.disable=1" ~~~ `vga=0x317` est déprécié, utiliser à la place : `gfxpayload=1024x768x16,1024x768` Copie de la "distro" d'origine, car nous allons la modifier ~~~bash cobbler distro copy --name ubuntu-server-x86_64 --newname=ubuntu-server-x86_64-orig ~~~ Modification du **Kickstart Metadata** de la distro **ubuntu-server-x86_64** \\ Nous changeons la ligne suivante : `tree=http://@@http_server@@/cblr/links/ubuntu-server-x86_64` \\ en \\ `tree=http://fr.archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64` ~~~bash cobbler distro edit --name=ubuntu-server-x86_64 --ksmeta='tree=http://fr.archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64' ~~~ Copie du fichier d'exemple preseed (sample.seed) Nous modifierons la copie de la manière suivante : `/var/lib/cobbler/kickstarts/ubuntu-server-16.04.seed` ~~~ d-i mirror/http/hostname string fr.archive.ubuntu.com d-i mirror/http/directory string /ubuntu ~~~ ~~~bash cp -p /var/lib/cobbler/kickstarts/sample.seed /var/lib/cobbler/kickstarts/ubuntu-server-16.04.seed sed -i -e 's%^\(d-i mirror/http/hostname string\).*%\1 fr.archive.ubuntu.com%' /var/lib/cobbler/kickstarts/ubuntu-server-16.04.seed sed -i -e 's%^\(d-i mirror/http/directory string\).*%\1 /ubuntu%' /var/lib/cobbler/kickstarts/ubuntu-server-16.04.seed ~~~ A faire aussi ~~~bash cp -p /var/lib/cobbler/scripts/preseed_late_default /var/lib/cobbler/scripts/preseed_late_ubuntu-server-16.04 sed -i -e 's/preseed_late_default/preseed_late_ubuntu-server-16.04/' /var/lib/cobbler/kickstarts/ubuntu-server-16.04.seed ~~~ On modifie le script de postinstall `/var/lib/cobbler/kickstarts/ubuntu-server-16.04.seed` ~~~bash echo "$hostname" > /etc/hostname /bin/hostname $hostname $SNIPPET('download_config_files') $SNIPPET('kickstart_done') ~~~ Lier le nouveau fichier kickstart/preseed au profile ~~~bash cobbler profile edit --name=ubuntu-server-16.04.vm --kickstart=/var/lib/cobbler/kickstarts/ubuntu-server-16.04.seed ~~~ Puis ~~~bash cobbler sync ~~~ L'adresse MAC un un chiffre hexadécimal écrit sous la forme '52:54:XX:XX:XX:XX' (où X est un chiffre en base 16 entre 0 et F) ~~~bash cobbler system add --name=${HostName} \ --gateway=${Gateway} \ --hostname=${HostName} \ --ipv6-autoconfiguration=false \ --power-type=ack_manual \ --profile=ubuntu-server-16.04.vm \ --repos-enabled=false \ --status=production \ --virt-auto-boot=0 \ --virt-type=kvm cobbler system edit --name=${HostName} \ --interface=ens3 \ --ip-address=${IP_Addr} \ --mac=$Mac \ --netmask=${NetMask} \ --static=1 ~~~ ## Retour arrière Effacement de la nouvelle distro Exemple à adapter ~~~bash cobbler system remove --name=ttest01 cobbler profile remove --name=ubuntu-server-16.04.vm cobbler profile remove --name=ubuntu-server-x86_64 cobbler distro remove --name=ubuntu-server-x86_64 cobbler repo remove --name=ubuntu-server-x86_64 ~~~