Error loading plugin mermaid
ParseError: syntax error, unexpected '=>' (T_DOUBLE_ARROW)
More info is available in the error log.
ParseError: syntax error, unexpected '=>' (T_DOUBLE_ARROW)
More info is available in the error log.
start_new_kickstart
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| start_new_kickstart [2025/08/31 14:52] – created Darren | start_new_kickstart [2025/08/31 15:04] (current) – Darren | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| This page describes the full workflow for automated CentOS VM or bare-metal provisioning using Kickstart and JSON configuration files hosted in Gitea. | This page describes the full workflow for automated CentOS VM or bare-metal provisioning using Kickstart and JSON configuration files hosted in Gitea. | ||
| - | --- | + | — |
| ===== Overview ===== | ===== Overview ===== | ||
| Line 17: | Line 17: | ||
| Configuration files are hosted in: | Configuration files are hosted in: | ||
| - | | + | < |
| + | https:// | ||
| - | --- | + | </ |
| + | |||
| + | — | ||
| ===== Repository Layout ===== | ===== Repository Layout ===== | ||
| - | | + | < |
| - | |-- ks.cfg | + | vm-scripts/ |
| - | |-- buildvm.sh | + | |
| - | |-- users.json | + | |
| - | |-- ssh.json | + | |
| - | |-- other-scripts/ | + | |
| - | --- | + | </ |
| - | ===== JSON Configuration ===== | + | | |
| - | *users.json* example: | + | | |
| + | | | ||
| + | | | ||
| + | | | ||
| - | [ | + | — |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | ] | + | |
| - | *ssh.json* example: | + | ===== JSON Configuration ===== |
| + | * users.json* example: | ||
| + | < | ||
| + | |||
| + | [ | ||
| { | { | ||
| - | "port": | + | "username": |
| - | "password_authentication": "no", | + | "ssh_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ...", |
| - | "permit_root_login": "no", | + | "password": "$6$abcd1234$..." |
| - | "allow_users": | + | }, |
| + | { | ||
| + | "username": "darren", | ||
| + | | ||
| } | } | ||
| + | ] | ||
| + | |||
| + | </ | ||
| + | |||
| + | * ssh.json* example: | ||
| + | |||
| + | < | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | |||
| + | — | ||
| - | --- | ||
| ===== Workflow Diagram ===== | ===== Workflow Diagram ===== | ||
| - | +----------------------------+ | + | +—————————-+ |
| - | | Boot VM / Bare-Metal Host | | + | |
| - | +------------+---------------+ | + | |Boot VM / Bare-Metal Host | |
| - | | | + | |
| - | v | + | +————+—————+ |
| - | +-------------------------------+ | + | |
| - | | Kickstart ISO / Network Boot | + | | | |
| - | +------------+------------------+ | + | |Kickstart ISO / Network Boot | |
| - | | | + | |
| - | v | + | +————+——————+ |
| - | +----------------------+ | + | |
| - | | %pre & %packages | + | | | |
| - | | (curl, jq, git, SSH) | | + | |%pre & %packages |
| - | +------------+---------+ | + | |(curl, jq, git, SSH)| |
| - | | | + | |
| - | v | + | +————+———+ |
| - | +----------------------+ | + | |
| - | | %post Section | + | | | |
| - | +------------+---------+ | + | |%post Section |
| - | | | + | |
| - | v | + | +————+———+ |
| - | +---------------------------+ | + | |
| - | | Download users.json | + | | | | | |
| - | +---------------------------+ +-----------------------+ | + | |Download users.json |
| - | | | + | |
| - | v | + | +—————————+ +———————–+ |
| - | +---------------------------+ | + | |
| - | | Download ssh.json | + | | | | | |
| - | +---------------------------+ +-----------------------+ | + | |Download ssh.json |
| - | | | + | |
| - | | + | +—————————+ +———————–+ |
| - | v | + | |
| - | +----------------------------------+ | + | | |
| - | | Clone VM scripts repo (vms) | | + | |Clone VM scripts repo (vms) | |
| - | +----------------------------------+ | + | |
| - | | | + | +———————————-+ |
| - | v | + | |
| - | +------------------------+ | + | | | |
| - | | Run buildvm.sh | + | |Run buildvm.sh |
| - | +------------------------+ | + | |
| - | | | + | +————————+ |
| - | v | + | |
| - | +------------------------+ | + | | | |
| - | | VM Deployment Complete | | + | |VM Deployment Complete| |
| - | +------------------------+ | + | |
| - | | | + | +————————+ |
| - | v | + | |
| - | +-------------------------------+ | + | | | |
| - | | Test SSH login, verify scripts| | + | |Test SSH login, verify scripts| |
| - | | and logs | | + | |and logs | |
| - | +-------------------------------+ | + | |
| + | +——————————-+ | ||
| + | |||
| + | — | ||
| - | --- | ||
| ===== Preparation Steps ===== | ===== Preparation Steps ===== | ||
| - | 1. Log into the VM (or bare-metal host) as root. | + | 1. Log into the VM (or bare-metal host) as root. 2. Create a `prepare-vm.sh` script: |
| - | 2. Create a `prepare-vm.sh` script: | + | < |
| - | | + | |
| - | yum update -y | + | yum update -y |
| - | yum install -y curl jq git openssh-server sudo vim | + | yum install -y curl jq git openssh-server sudo vim |
| - | systemctl enable --now sshd | + | systemctl enable --now sshd |
| - | iptables -I INPUT -p tcp --dport 22022 -j ACCEPT | + | iptables -I INPUT -p tcp --dport 22022 -j ACCEPT |
| - | setenforce 0 | + | setenforce 0 |
| - | sed -i ' | + | sed -i ' |
| - | if ! id vms &>/ | + | if ! id vms &>/ |
| - | useradd -m -s /bin/bash vms | + | useradd -m -s /bin/bash vms |
| - | echo " | + | echo " |
| - | echo "vms ALL=(ALL) NOPASSWD: | + | echo "vms ALL=(ALL) NOPASSWD: |
| - | chmod 440 / | + | chmod 440 / |
| - | fi | + | fi |
| + | |||
| + | </ | ||
| 3. Make it executable and run: | 3. Make it executable and run: | ||
| + | < | ||
| - | | + | |
| - | sudo / | + | sudo / |
| + | |||
| + | </ | ||
| 4. Verify package installation and SSH: | 4. Verify package installation and SSH: | ||
| - | | + | < |
| - | jq --version | + | |
| - | git --version | + | jq --version |
| - | sshd -T | grep port | + | git --version |
| - | id vms | + | sshd -T | grep port |
| + | id vms | ||
| + | |||
| + | </ | ||
| 5. Verify network access to Gitea: | 5. Verify network access to Gitea: | ||
| + | < | ||
| - | | + | |
| - | curl -I https:// | + | curl -I https:// |
| - | --- | + | </ |
| + | |||
| + | — | ||
| ===== Kickstart Deployment ===== | ===== Kickstart Deployment ===== | ||
| Line 158: | Line 187: | ||
| Boot the VM using the CentOS ISO and pass the Kickstart URL: | Boot the VM using the CentOS ISO and pass the Kickstart URL: | ||
| - | | + | < |
| + | | ||
| + | |||
| + | </ | ||
| The Kickstart `%post` section will: | The Kickstart `%post` section will: | ||
| Line 170: | Line 202: | ||
| Check logs in `/ | Check logs in `/ | ||
| - | --- | + | — |
| ===== Post-Deployment ===== | ===== Post-Deployment ===== | ||
| Line 176: | Line 208: | ||
| 1. SSH into the new VM: | 1. SSH into the new VM: | ||
| - | | + | < |
| + | | ||
| + | |||
| + | </ | ||
| + | |||
| + | < | ||
| + | ls / | ||
| - | ls /home/ | + | </code> |
| 3. Confirm users exist and have proper SSH access. | 3. Confirm users exist and have proper SSH access. | ||
| - | --- | + | — |
| ===== Notes ===== | ===== Notes ===== | ||
| - | * JSON-driven configuration allows dynamic management of users and SSH without modifying Kickstart. | + | * JSON-driven configuration allows dynamic management of users and SSH without modifying Kickstart. * Firewall and SELinux adjustments are handled in `prepare-vm.sh`. * Test in a VM before deploying on bare-metal. * Update JSON files in Gitea to manage changes dynamically. |
| - | * Firewall and SELinux adjustments are handled in `prepare-vm.sh`. | + | |
| - | * Test in a VM before deploying on bare-metal. | + | |
| - | * Update JSON files in Gitea to manage changes dynamically. | + | |
| ===== JSON Configuration Reference ===== | ===== JSON Configuration Reference ===== | ||
| - | ^ File ^ Key ^ Purpose ^ Example | + | ^File^Key^Purpose^Example| |
| - | | users.json | username | Linux account to create | " | + | |users.json|username|Linux account to create|" |
| - | | users.json | ssh_key | Public SSH key for user login | " | + | |users.json|ssh_key|Public SSH key for user login|" |
| - | | users.json | password | Optional hashed password | " | + | |users.json|password|Optional hashed password|" |
| - | | ssh.json | + | |ssh.json |
| - | | ssh.json | + | |ssh.json |
| - | | ssh.json | + | |ssh.json |
| - | | ssh.json | + | |ssh.json |
/var/www/wiki.darrenwindle.co.uk/public_html/data/attic/start_new_kickstart.1756648328.txt.gz · Last modified: 2025/08/31 14:52 by Darren