cloudymax / pxeless

An automated system install and image customization tool for when PXE is not an option, or is not an option yet.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

An issue within the readme example

rit001 opened this issue Β· comments

Hi,

Thanks for doing so much of the heavy lifting in terms of providing a solution that allows features like cloud-init to be useful.

One thing you have the following example in your readme.md

docker build -t iso-generator . &&
docker run -it --mount type=bind,source="$(pwd)",target=/app iso-generator
ubuntu-autoinstall-generator.sh -a -u user-data.example -n jammy

The version of ubuntu-autoinstall-generator.sh over at covertsh/ubuntu-autoinstall-generator does not have an -n option.

Currently, it is not clear if you have a typo in your example or maybe an extended version of the script.

Thanks again

commented

Thanks for pointing that out - looks like i do have a few issues in the README.

First:

I've corrected the example commands to be:

docker build -t iso-generator . && \
docker run -it --mount type=bind,source="$(pwd)",target=/app iso-generator \
image-create.sh -a -u user-data.example -n jammy

Second:

I added the -n option to my branch to allow you to specifiy an ubuntu code-name (like focal or jammy)

Here's the function that variable is used with:

# get the url and iso infor for the latest release
latest_release(){
        BASE_URL="https://releases.ubuntu.com/${CODE_NAME}/"
        log "πŸ”Ž Checking for latest ${CODE_NAME} release..."
        ISO_FILE_NAME=$(curl -sSL "${BASE_URL}" |grep -oP "ubuntu-.*-server-amd64.iso" |head -n 1)
        IMAGE_NAME=$(curl -sSL ${BASE_URL} |grep -o 'Ubuntu .* LTS .*)' |head -n 1)
        CURRENT_RELEASE=$(echo "${ISO_FILE_NAME}" | cut -f2 -d-)
        SHA_SUFFIX="${CURRENT_RELEASE}"
        log "βœ… Latest release is ${CURRENT_RELEASE}"
}

# get the url and iso info for a daily release
daily_release(){
        BASE_URL="https://cdimage.ubuntu.com/ubuntu-server/${CODE_NAME}/daily-live/current"
        log "πŸ”Ž Checking for daily ${CODE_NAME} release..."
        ISO_FILE_NAME=$(curl -sSL "${BASE_URL}" |grep -oP "${CODE_NAME}-live-server-amd64.iso" |head -n 1)
        IMAGE_NAME=$(curl -sSL ${BASE_URL} |grep -o 'Ubuntu .* LTS .*)' |head -n 1)
        CURRENT_RELEASE=$(echo "${IMAGE_NAME}" | awk '{print $3}')
        SHA_SUFFIX="${CURRENT_RELEASE}"
        log "βœ… Daily release is ${CURRENT_RELEASE}"
}

There is a short description in the help-text as well:

-n, --code-name         The Code Name of the Ubuntu release to download (focal, jammy etc...)

And here are some usage examples:

> docker run -it --mount type=bind,source="$(pwd)",target=/app iso-generator image-create.sh -a -u user-data.basic -n jammy

[2022-08-25 16:07:06] πŸ“ Created temporary working directory /tmp/tmp.ZPRPX2PF6F
[2022-08-25 16:07:06] πŸ“ Created temporary build directory /tmp/tmp.LefesDV388
[2022-08-25 16:07:06] πŸ‘Ά Starting up...
[2022-08-25 16:07:06] πŸ”Ž Checking for daily jammy release...
[2022-08-25 16:07:06] βœ… Daily release is 22.04.1
[2022-08-25 16:07:06] βœ… 22.04.1 is greater than 20.10. Not a legacy image.

> docker run -it --mount type=bind,source="$(pwd)",target=/app iso-generator image-create.sh -a -u user-data.basic -n focal
[2022-08-25 16:09:56] πŸ“ Created temporary working directory /tmp/tmp.gQe132NkQJ
[2022-08-25 16:09:56] πŸ“ Created temporary build directory /tmp/tmp.5CjZC2VPBw
[2022-08-25 16:09:56] πŸ‘Ά Starting up...
[2022-08-25 16:09:56] πŸ”Ž Checking for daily focal release...
[2022-08-25 16:09:57] βœ… Daily release is 20.04.5
[2022-08-25 16:09:57] ❗ 20.04.5 is lower than 20.10. Marking image as legacy.

Thanks for the quick update to the examples. As a side note your example user-data.basic seems to be a very personal example.

commented

Yeah that's an accurate description, I wanted to add something that contained more variety of modules used than many other cloud init tutorials and ended up using a mildly sanitized version of my own homelab's config.

I'm not really sure how best to approach providing examples for this project since there's so many possibilities. I'm definitely open to feedback and suggestions in that regard.

There is a companion repo to this one that focuses more on using cloud-init to provision QEMU VMs and has some more examples, as well as some private templates I could clean up and provide if that would be helpful.

You can see some of that work here https://github.com/cloudymax/Scrap-Metal/blob/main/virtual-machines/user-data.sh though it is not documented enough for a release at this time.

My other thought was to simply link to a few other projects and blogs like this one from Puget systems that also cover the topic as an attempt to lessen my own responsibility for maintaining documentation.

OK, I think adding much of your reply into the readme.md would provide enough background for most people. I am guessing that anyone who finds your repo is looking for a starting point that they can then build on.

As it is a personal example I think the only changes I would suggest are

- document the password you have set
- remove the font change.

Those 2 changes would at least allow someone to build an iso with your example and then log in to it. The font change can become 'interesting' depending on the test environment - with your settings I end up with a 30x20 screen :(

commented

Thanks for the feedback, I'll scale back on the provided example cloud-init and update the documentation to point to resources with more advanced examples.