Skip to content

Instantly share code, notes, and snippets.

@tlhakhan
tlhakhan / deploy_vm.sh
Last active March 16, 2022 23:09
Deploy ESXi virtual machines
#!/bin/sh
# DESCRIPTION:
# this script will create a virtual machine on an ESXi 6+ hypervisor.
# it will create a small vm to specification from the vmx template config.
# it will create a small thin provisioned disk with 8G as OS drive.
# it will mount an ISO image and have the cdrom ready for install.
#
# pre-reqs: this script needs to be in the root-path of the vmfs datastore where you want to deploy vms.
# pre-reqs: this script needs to have the cwd changed to basedir of this script.
@tlhakhan
tlhakhan / ansible-rpm-build.sh
Last active December 3, 2019 19:53
Ansible - Building RPM
#!/bin/bash
#
# let's make an ansible rpm for offline deployment
#
yum makecache
yum -y update
# rpm build deps
@tlhakhan
tlhakhan / my-rpms.sh
Last active April 1, 2017 20:47
Offline software repo
#!/bin/bash
#
# let's make an offline repo of mfu software
#
# deps
yum install -y yum-utils-1.1.31-40.el7.noarch
#
@tlhakhan
tlhakhan / centos.pac
Last active July 14, 2018 18:31
centos: good packlist
# goodies
lsof
tree
# info tools
net-tools # provides ifconfig, netstat
bind-utils # provides host
# performance tools
sysstat
@tlhakhan
tlhakhan / gist:c980c3c526d23190bed353110772f906
Created January 13, 2018 16:45
godoc web service on CentOS
yum install -y epel; yum makecache
yum install -y golang-godoc golang-docs
cat < 'eof' > /etc/systemd/system/godoc.service
[Unit]
Description = golang godoc web server
[Service]
ExecStart=/usr/bin/godoc -http :8080
Restart=always
# Reload the file with Prefix r.
bind r source-file ~/.tmux.conf \; display "Reloaded!"
set -g mouse off
set -g default-terminal "screen-256color"
# bar style
set -g status-style fg=white,bold,bg=black
setw -g window-status-style fg=cyan,bg=black
setw -g window-status-current-style fg=white,bold,bg=red
@tlhakhan
tlhakhan / remapCapsLockToEsc.reg
Created July 23, 2019 12:04
remap caps lock to escape for windows
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,3a,00,46,00,01,00,3a,00,00,00,00,00
@tlhakhan
tlhakhan / user-data.yml
Last active October 30, 2024 21:45
Ubuntu 20.04 example autoinstall user-data file
#cloud-config
autoinstall:
version: 1
early-commands:
- systemctl stop ssh # otherwise packer tries to connect and exceed max attempts
- hostnamectl set-hostname ubuntu-00 # update hostname even for the installer environment
- dhclient # re-register the updated hostname
network:
@tlhakhan
tlhakhan / ubuntu2004.ipxe
Last active December 21, 2023 15:50
iPXE script for deploying Ubuntu 20.04 autoinstall nocloud-net method
#!ipxe
# ubuntu focal 20.04
# $seedfrom used to find the user-data and meta-data files by nocloud-net provider for cloud-init.
# the trailing slash is important, the cloud-init sticks 'meta-data' or 'user-data' right after it, without prepending a forward slash.
set seedfrom http://repo/files/ubuntu2004/
# $base url is where the vmlinuz and initrd live.
# they were fished out from the live-server iso file. the iso file is also in this directory.
set base http://repo/files/ubuntu2004
@tlhakhan
tlhakhan / build_empty_iso.sh
Created May 5, 2020 21:02
Build an empty iso file
#!/bin/bash
IMAGE=empty.iso
BUILD=/dev/null
mkisofs -r -V "Empty ISO" -J -l -o $IMAGE $BUILD