Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍🏭

Gonéri Le Bouder goneri

👨‍🏭
View GitHub Profile
View gist:6afd05397390cf5a0976f3611814949a
- name: Collect the list of the existing VM
vcenter_vm_info:
register: existing_vms
until: existing_vms is not failed
- name: Turn off the VM
vcenter_vm_power:
state: stop
vm: '{{ item.vm }}'
with_items: "{{ existing_vms.value }}"
@goneri
goneri / start_kind_in_vm.sh
Last active Jul 29, 2021
Start kind in a VM (Virt-Lightning)
View start_kind_in_vm.sh
!/bin/bash
set -eux
vl start fedora-34 --memory 2000 --name kind-vm
target=$(vl status|awk '/kind-vm/ {print $4}')
public_ip=$(vl status|awk '/kind-vm/ {print $4}'|sed 's,.\+@,,')
rc_file=/tmp/k8s_rc
ssh $target '
curl -L -o /tmp/kubectl "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x /tmp/kubectl
View gist:831994b3dbbd6500dc06079e097ebe43
root@dragonflybsd-600-hammer2:/home/goneri # panic: no volume for offset 0x0000000040010000
cpuid = 0
Trace beginning at frame 0xfffff800677a7260
hammer2_get_volume() at hammer2_get_volume+0x4b 0xffffffff8098334b
hammer2_get_volume() at hammer2_get_volume+0x4b 0xffffffff8098334b
_hammer2_io_getblk() at _hammer2_io_getblk+0x182 0xffffffff8095fcf2
hammer2_io_new() at hammer2_io_new+0x17 0xffffffff809605f7
hammer2_chain_modify() at hammer2_chain_modify+0x342 0xffffffff8096e302
hammer2_chain_create() at hammer2_chain_create+0xe31 0xffffffff8096fe01
Debugger("panic")
@goneri
goneri / vcenter_curl_rest_api.sh
Last active Jun 14, 2021
vcenter_curl_rest_api.sh
View vcenter_curl_rest_api.sh
#!/bin/bash
set -x
server='https://vcenter.test'
password=$(crudini --get /tmp/inventory-vmware_rest 'vmware_rest:vars' 'vcenter_password')
session_id=$(curl -q --http1.1 -X POST -k -u "administrator@vsphere.local:${password}" ${server}/rest/com/vmware/cis/session|jq -r .value)
function get() {
path=$1
curl -ik -H vmware-api-session-id:${session_id} -X GET ${server}$path
echo ""
View gist:fff68863f2a215a8ab362302f4e76354
Mounting root from hammer2:vbd0s3
hammer2_mount: root devstr="vbd0s3"
hammer2_mount: dev="vbd0s3" label="DATA" rdonly=1
hammer2_ondisk: "/dev/vbd0s3" zone=3 id=0 offset=0x0000000000000000 size=0x0000000322800000
hammer2_ondisk: total size 0x0000000057000000 does not equal sum of volumes 0x0000000322800000
Root mount failed: 22
Manual root filesystem specification:
<fstype>:<device> Specify root (e.g. ufs:da0s1a)
? List valid disk boot devices
View gist:7c7dd1dacb2d6e14cead0608fda92de3
root@dragonflybsd-600-hammer2:~ # fsck_hammer2 /dev/vbd0s3
volume header
zone.0 0000000000000010 (best)
zone.1 exceeds volume size
freemap
zone.0 0000000000000010 (best)
1 blockref (0 node, 1 leaf), 32.00KB
zone.1 exceeds volume size
View ansible-venv.fish
#!/usr/bin/env fish
# License: GPLv3+
# Usage:
# To start a venv with the default python3 and Ansible devel:
# . ~/bin/ansible-venv.fish
#
# To start a venv with a specific version:
# . ~/bin/ansible-venv.fish 3.4 stable-2.9
if test (count $argv) -eq 2
@goneri
goneri / set_shortcuts.sh
Last active Apr 11, 2021
AwesomeWM like key shortcuts for Gnome3
View set_shortcuts.sh
#!/bin/bash
set -eux
for i in $(seq 9); do
gsettings set org.gnome.shell.keybindings switch-to-application-$i '[]'
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-$i "['<Super>$i']"
done
gsettings set org.gnome.desktop.wm.keybindings toggle-fullscreen "['<Super>f']"
#gsettings set org.gnome.desktop.wm.keybindings toggle-maximized "['<Super>f']"
gsettings set org.gnome.desktop.interface enable-animations false
View gist:ad252e30d48cfea99aaeb2e18736303e
- hosts: localhost
gather_facts: false
tasks:
- k8s_info:
kind: Pod
with_sequence: count=100
View upload-nodepool-image.sh
#!/bin/bash
set -eux
aws --version |grep aws-cli || pip install awscli
bucket_name="nodepool-images-test"
if ! aws s3 ls s3://${bucket_name}; then
aws s3 mb s3://${bucket_name} --region us-east-2
fi
for image_local_path in $(find /opt/nodepool/images -maxdepth 1 -name 'centos-8-0000002059.raw'); do