diff --git a/README.md b/README.md new file mode 100644 index 0000000..d14c93c --- /dev/null +++ b/README.md @@ -0,0 +1,120 @@ +# Домашнее задание 29 + +## DHCP, PXE установка Ubuntu 24.04 через http +Для выполнение задания используется vagrant box Ubuntu 22.04 а так же пустой box onyxpoint/empty для установки новой системы через PXE + +### Создание Vagrantfile + +Зададим следующие характеристики для VM + +**pxe-server** +- CPU - 1 +- Memory - 1024mb + +**pxe-client** +- CPU - 2 +- Memory - 4096mb + +После запуска **pxe-client** vagrant завершится с ошибкой. Это связано с тем, что там нет никакой системы и установлен timeout 10 секунд на ожидание загрузки. + + +Готовый [Vagrantfile](Vagrantfile) + + +### Cоздание ansible.yml + +Сценарий для Ansible будет выполнять следующие действия: + +1. Обновление пакетов +2. Установка dhcp-server, tftp-server, apache, syslinux, pxelinux +3. Скачивание образа Ubuntu server 24.04 +4. Конфигурирование dhcp сервера +5. Конфигурирование tftp сервера + +Готовый [ansible.yml](ansible.yml) + +### Autoinstall + +При загрузке vm **pxe-client** через tftp, выйдет меню. + +1. Автоустановка (по умолчанию ) +2. Ручная установка + +В режиме автоустановке, подгрузится минимальный user-data для установки. +Будет создан пользователь **administrator** с паролем **QazXdr1010** + +Готовый [user-data](user-data) + +### Конфигурация tftp и dhcp + +При настройки tftp и dhcp ansible будет использовать шаблоны + +[dhcpd.template](dhcpd.template) +[pxelinux.template](pxelinux.template) + + +### Проверка + +Запускаем vagrant +```bash +lex@ubuntu-pc:~/Документы/29$ vagrant up --no-provision +Bringing machine 'pxe-server' up with 'virtualbox' provider... +Bringing machine 'pxe-client' up with 'virtualbox' provider... +==> pxe-server: Checking if box 'ubuntu/jammy64' version '20241002.0.0' is up to date... +==> pxe-server: Clearing any previously set forwarded ports... +==> pxe-server: Clearing any previously set network interfaces... +==> pxe-server: Preparing network interfaces based on configuration... + pxe-server: Adapter 1: nat + pxe-server: Adapter 2: intnet +==> pxe-server: Forwarding ports... + pxe-server: 22 (guest) => 2222 (host) (adapter 1) +==> pxe-server: Running 'pre-boot' VM customizations... +==> pxe-server: Booting VM... +==> pxe-server: Waiting for machine to boot. This may take a few minutes... + pxe-server: SSH address: 127.0.0.1:2222 + pxe-server: SSH username: vagrant + pxe-server: SSH auth method: private key + pxe-server: Warning: Connection reset. Retrying... + pxe-server: Warning: Remote connection disconnect. Retrying... +==> pxe-server: Machine booted and ready! +... + +... +If you look above, you should be able to see the error(s) that +Vagrant had when attempting to connect to the machine. These errors +are usually good hints as to what may be wrong. + +If you're using a custom box, make sure that networking is properly +working and you're able to connect to the machine. It is a common +problem that networking isn't setup properly in these boxes. +Verify that authentication configurations are also setup properly, +as well. + +If the box appears to be booting properly, you may want to increase +the timeout ("config.vm.boot_timeout") value. + +``` + + +Видим, что vagrant завршился с ошибкой, это нормально! + +Открываем Virtualbox и видим что меню c выбором установки загрузилось, ничего не трогаем, ждем. + +![29_1](images/29_1.png) + +Идет скачивание образа iso + +![29_2](images/29_2.png) + +Инициализация user-data + +![29_3](images/29_3.png) + +После утсановки не забываем отключить загрузку по сети в настройка VM, или нажать F12 и выбрать загрузку с диска + +Ну и как VM запустится, мы видим стандартное приветствие. + +![29_4](images/29_4.png) + + +Все готово! \ No newline at end of file