Skip to content

Instantly share code, notes, and snippets.

View goneri's full-sized avatar
🇺🇦

Gonéri Le Bouder goneri

🇺🇦
View GitHub Profile
@goneri
goneri / prepare_work_env.fish
Created June 28, 2019 19:31
Prepare a dev work env for Ansible
#/usr/bin/fish
set github_account "goneri"
#git clone [email protected]:ansible/ansible upstream
for i in a b c
set -x GIT_DIR $i/.git
git clone --shared --origin upstream upstream $i
git remote add goneri [email protected]:{goneri}/ansible.git
ansible-test units --tox --python 3.7 '.*vmware.*'
#freebsd
echo new_pw | pw mod user my_user -h 0
@goneri
goneri / vmdk_to_qcow2.sh
Created May 3, 2019 20:35
vCenter-Server-Appliance.vmdk to qcow2
#!/usr/bin/python3
import subprocess
from pathlib import Path
vmdk_files = [Path("vCenter-Server-Appliance.vmdk")]
while True:
new_file = Path("vCenter-Server-Appliance_%d.vmdk" % len(vmdk_files))
if not new_file.exists():
break
@goneri
goneri / resize_root.sh
Last active May 20, 2019 06:06
NetBSD: resize / using resize_ffs
gpt resizedisk ld0
gpt resize -i 2 ld0
reboot
dkctl ld0 makewedges
mount -ur /
resize_ffs -p -y -v /dev/rdk1
fsck -fy /dev/rdk1
reboot
@goneri
goneri / gist:8e458786bcd81d598cab468d73509d64
Last active May 19, 2019 03:15
Prepare a raw image of NetBSD with an experimental port of cloud-init
#!/bin/sh
set -eux
MNT=new
FILE=new.img
VND=vnd0
mkdir new
dd if=/dev/zero of=${FILE} bs=4096 count=1015200 progress=62000
vnconfig ${VND} ${FILE}
See: https://github.com/virt-lightning/freebsd-cloud-images
@goneri
goneri / cloudify.sh
Last active April 16, 2019 18:58
Cloudify the FreeBSD image
# Grab an image from http://ftp.freebsd.org/pub/FreeBSD/releases/VM-IMAGES/
# Start it using QEMU, e.g: qemu-system-x86_64 -drive file=FreeBSD-13.0-CURRENT-amd64.qcow2 -net nic,model=virtio -net user -m 1G
# Login and fetch the script:
# fetch --no-verify-peer https://gist.githubusercontent.com/XXXXX
# sh cloudify.sh
# Done
export ASSUME_ALWAYS_YES=YES
cd /tmp
# pkg install py27-cloud-init
# cd /usr/local/lib/python2.7/site-packages/cloudinit
# curl -L https://code.launchpad.net/~goneri/cloud-init/+git/cloud-init/+merge/364997/+preview-diff/867430/+files/preview.diff | patch -u -p2
# Use the following branch: https://github.com/goneri/cloud-init/tree/freebsd_apply_network
# Add the blkid fake binary:
root@localhost:/mnt # cat /usr/local/bin/blkid
#!/bin/sh
virt-install --connect qemu:///system \
-n esxi-65 -r 4096 \
--vcpus=sockets=1,cores=2,threads=2 \
--cpu host --disk path=/var/lib/libvirt/images/esxi-65.qcow2,size=30 \
-c /home/goneri/Downloads/VMware-VMvisor-Installer-6.5.0.update01-5969303.x86_64.iso --os-type generic \
--accelerate --network=bridge:virbr0,model=e1000 \
--hvm --graphics vnc,listen=0.0.0.0