Skip to content

Commit

Permalink
docs(idrac-os): updated the docs to use the files from a webserver
Browse files Browse the repository at this point in the history
Signed-off-by: sakethanne <asvn.saketh@gmail.com>
  • Loading branch information
Sakethanne authored and glimchb committed Nov 14, 2024
1 parent 08f5135 commit 1b4ddfc
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 54 deletions.
112 changes: 58 additions & 54 deletions Documentation/Auto_install_ubuntu_iso.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ mkdir source-files
wget https://releases.ubuntu.com/jammy/ubuntu-22.04.5-live-server-amd64.iso
```

From here on stay in the iso_files directory for all the rest of the commands.

### Step 2: Extract the ISO contents

Use 7z to unpack the ISO. It will extract MBR and EFI partition images automatically.
Expand All @@ -60,9 +58,11 @@ cd ..

Open **source-files/boot/grub/grub.cfg** and add the following menu entry above the existing ones (it should be the first menuentry option).

This option will be shown during the Booting process and be automatically selected in 30 seconds, if there is no input from the user.
This option will be shown during the Booting process as **Autoinstall Ubuntu Server** and be automatically selected in 30 seconds, if there is no input from the user.
![Booting Menu](../images/os-install/dell/BootMenu.png)

#### If the server configuration files (**user-data** and **meta-data**) needs to be local to the ISO, then use the below menuentry definition

```bash
menuentry "Autoinstall Ubuntu Server" {
set gfxpayload=keep
Expand All @@ -71,82 +71,78 @@ initrd /casper/initrd
}
```

Now, your grub.cfg file should look like ![this](../images/os-install/dell/GrubFile.png)
#### If the server configuration files (**user-data** and **meta-data**) are stored on a remote server, and be picked dynamically use the below menuentry definition, and make sure the web server is up and running and the files as accessible

```bash
menuentry "Autoinstall Ubuntu Server" {
set gfxpayload=keep
linux /casper/vmlinuz quiet autoinstall ds=nocloud\;s=http://ip-address/path-to-server-folder/ ---
initrd /casper/initrd
}
```

Where the **server** folder contains the **user-data** and the **meta-data** files.

### Step 5: Create a directory for auto-install configuration files

This directory will hold the user-data and meta-data files required to build the auto-install iso

```bash
mkdir source-files/server
mkdir server
```

### Step 6: Add an empty meta-data file (cloud-init requires its presence)
### Step 6: Create a meta-data file (cloud-init requires its presence) under the server directory

```bash
touch source-files/server/meta-data
touch server/meta-data
```

### Step 7: Create a user-data file
You can find the sample **meta-data** file [here](../ansible/iso_files/server/meta-data)

### Step 7: Create a user-data file in the server directory

This file will contain the auto-install user configuration. You can add your own settings here.

The below are the current settings(user-data) that we are using, you can refer to the Ubuntu Autoinstall documentation for more details.
You can refer to the Ubuntu Autoinstall documentation for more details. You can find the sample **user-data** file [here](../ansible/iso_files/server/user-data).

Under the Identity section, we need to provide a hashed password, which can be done using the following commands

```bash
autoinstall:
version: 1
early-commands:
- ["cat", "/autoinstall.yaml"]
refresh-installer:
update: yes
apt:
preserve_sources_list: false
mirror-selection:
primary:
- country-mirror
- uri: "http://archive.ubuntu.com/ubuntu"
arches: [i386, amd64]
- uri: "http://ports.ubuntu.com/ubuntu-ports"
arches: [s390x, arm64, armhf, powerpc, ppc64el, riscv64]
fallback: abort
geoip: true
sources:
git-ppa:
source: ppa:git-core/ppa
identity:
hostname: opi
password: "hashedpassword"
realname: opi
username: opi
keyboard:
layout: us
toggle: ""
variant: ""
locale: en_US
ssh:
allow-pw: true
authorized-keys: []
install-server: true
storage:
layout:
name: lvm
match:
size: largest
late-commands:
- 'echo ''APT::Install-Recommends "false";'' >/target/etc/apt/apt.conf.d/02InstallRecommends'
openssl passwd -6
```

Under the Identity section, we need to provide a hashed password, which can be done using the following commands
This will prompt you to enter a password, which will be hashed and displayed. You can then update the **user-data**** file with the latest password using the below command

```bash
openssl passwd -6
sed -i 's/password: ".*"/password: "<<Password_from_above_openssl_command>>"/' ~/lab/ansible/iso_files/server/user-data
```

This will prompt you to enter a password, which will be hashed and displayed. You can then copy it to the autoinstall user-data file above.
**Note:** If the server configuration files need to be local to the ISO, then keep the **server** folder under the **source-files** directory. Else keep the **server** folder in the accessible remote server.

### Step 8: Generate the Custom Ubuntu 22.04 Autoinstall ISO

Make sure this is the directory structure before you run the below commands

```plaintext
iso_files
├── ubuntu-22.04.5-live-server-amd64.iso
├── BOOT
├── source-files
│ ├── server
│ │ ├── meta-data
│ │ └── user-data
│ ├── boot
│ ├── └── grub
│ ├────── └── grub.cfg
│ ├── casper
│ ├── dists
│ ├── EFI
│ ├── install
│ ├── md5sum.txt
│ ├── pool
│ └── boot.catalog
```

To generate the custom Ubuntu 22.04 autoinstall ISO, you can use the following command

```bash
Expand All @@ -163,11 +159,19 @@ xorriso -as mkisofs -r \
-iso_mbr_part_type a2a0d0ebe5b9334487c068b6b72699c7 \
-c '/boot.catalog' \
-b '/boot/grub/i386-pc/eltorito.img' \
-no-emul-boot -boot-load-size 4 -boot-info-table --grub2-boot-info \
-no-emul-boot -boot-load-size 4 -boot-info-table --grub2-boot-info \
-eltorito-alt-boot \
-e '--interval:appended_partition_2:::' \
-no-emul-boot \
.
```

This will create a new autoinstall iso with the name: **ubuntu-22.04-autoinstall.iso**, that can be used for installation.

### Subsequent Autoinstall ISO updates

For updates to the Autoinstall ISO:

If the server configuration files are local to the ISO, then update the configuration files (**user-data** and **meta-data** files) in Step 6 and Step 7, then run **xorriso** command in Step 8 to create an updated ISO.

Else, if the server configuration files are stored on a remote server. All you need to do is just make the modifications to the **user-data** and the **meta-data** file in the remote server and re-install the OS using the same ISO. It will automatically pick the latest updates.
1 change: 1 addition & 0 deletions ansible/iso_files/server/meta-data
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
local-hostname: dh1
41 changes: 41 additions & 0 deletions ansible/iso_files/server/user-data
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
autoinstall:
version: 1
early-commands:
- ["cat", "/autoinstall.yaml"]
refresh-installer:
update: yes
apt:
preserve_sources_list: false
mirror-selection:
primary:
- country-mirror
- uri: "http://archive.ubuntu.com/ubuntu"
arches: [i386, amd64]
- uri: "http://ports.ubuntu.com/ubuntu-ports"
arches: [s390x, arm64, armhf, powerpc, ppc64el, riscv64]
fallback: abort
geoip: true
sources:
git-ppa:
source: ppa:git-core/ppa
identity:
hostname: opi
password: "hashedpassword"
realname: opi
username: opi
keyboard:
layout: us
toggle: ""
variant: ""
locale: en_US
ssh:
allow-pw: true
authorized-keys: []
install-server: true
storage:
layout:
name: lvm
match:
size: largest
late-commands:
- 'echo ''APT::Install-Recommends "false";'' >/target/etc/apt/apt.conf.d/02InstallRecommends'
Binary file modified images/os-install/dell/GrubFile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1b4ddfc

Please sign in to comment.