Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍🏭

Gonéri Le Bouder goneri

👨‍🏭
View GitHub Profile
@goneri
goneri / cherry_pick_patch_demo.sh
Last active Feb 21, 2020
Cherry pick a patch, even if the file has been renamed.
View cherry_pick_patch_demo.sh
#!/bin/bash
set -eux
git clone https://github.com/goneri/ansible_vmware_collection /tmp/cherry_pick_demo
cd /tmp/cherry_pick_demo
# starts a dev branch
git checkout -B dev origin/master
git mv community/vmware/plugins/modules/vmware_dvswitch.py ansible/vmware/plugins/modules/
@goneri
goneri / vmware_coverage.sh
Last active Feb 18, 2020
Ansible VMware module test coverage
View vmware_coverage.sh
#!/bin/bash
echo "module,status"
for module in $(find lib -type f -name 'vmware*.py' -or -name 'vca*.py' -or -name 'vcenter*.py'|xargs -n1 basename -s .py|sort -u); do
aliases_file="test/integration/targets/${module}/aliases"
current_status="no_test"
if [ -f "${aliases_file}" ]; then
if [ -n "$(egrep '(disabled)' ${aliases_file})" ]; then
current_status="disabled"
elif [ -n "$(grep zuul ${aliases_file})" ]; then
@goneri
goneri / prepare-open-vm-tools-vm.sh
Created Feb 14, 2020
prepare a minimalist VM with open-vm-tools
View prepare-open-vm-tools-vm.sh
#!/bin/bash
curl -o minimal.qcow2 http://mirror.csclub.uwaterloo.ca/fedora/linux/releases/31/Cloud/x86_64/images/Fedora-Cloud-Base-31-1.9.x86_64.qcow2
virt-sysprep --network --install open-vm-tools --uninstall cloud-init --root-password password:root --selinux-relabel -a minimal.qcow2
qemu-img convert -p -f qcow2 -O vmdk -o compat6=on -o adapter_type=lsilogic minimal.qcow2 minimal.vmdk
scp minimal.vmdk centos@datastore.test:/srv/share/vms/minimal.vmdk
ssh root@esxi1.test 'rm -r /vmfs/volumes/rw_datastore/vm_sample1'
ssh root@esxi1.test mkdir /vmfs/volumes/rw_datastore/vm_sample1
ssh root@esxi1.test vmkfstools -i /vmfs/volumes/rw_datastore/minimal.vmdk -d thin /vmfs/volumes/rw_datastore/vm_sample1/vm_sample1.vmdk
View gist:ea6ba7806478751ab179bda5d928ef12
sudo mkfs.xfs -L nvme_cache -f /dev/nvme0n1
sudo mkdir -p /srv/nvme
sudo bash -c 'echo /dev/disk/by-label/nvme_cache /srv/nvme xfs defaults 0 0 >> /etc/fstab'
sudo mount /srv/nvme
echo "
[[local|localrc]]
ADMIN_PASSWORD=secret
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
@goneri
goneri / gist:b5c3a9b30e4768c6859303778ca86402
Created Jan 10, 2020
split-up ansible-test role list
View gist:b5c3a9b30e4768c6859303778ca86402
- hosts: localhost
vars:
split_in: 4
do_number: 1 # 1 to 4
tasks:
- command: 'ansible-test integration --python 3.7 -vvv --list-targets zuul/vmware/vcenter_1esxi/'
register: ansible_test_targets
- set_fact:
@goneri
goneri / gist:eee92b6d3cd1f7f5245a0419dabf6f86
Created Jan 7, 2020
Allow HTTP traffic from libvirt VM to the Hypervisor
View gist:eee92b6d3cd1f7f5245a0419dabf6f86
firewall-cmd --zone=libvirt --add-service=http --permanent
firewall-cmd --reload
View devstack post-reboot
ip l set up br-ex
ip a add 172.24.4.1/24 dev br-ex
losetup -f /opt/stack/data/stack-volumes-lvmdriver-1-backing-file
losetup -f /opt/stack/data/stack-volumes-default-backing-file
iptables-restore save
View vcsa_single_disk.sh
#!/bin/bash
set -eux
systemctl stop multi-user.target
systemctl stop applmgmt
systemctl stop getty@tty1.service
systemctl stop getty@tty2.service
systemctl stop vami-lighttp
systemctl stop dnsmasq
systemctl stop vmafdd
View ansible_vmware_number_per_type.sh
#!/bin/bash
echo VMware module. Number per type:
echo -n ' pyvmomi: '
ag -H -l PyVmomi lib/ansible/modules/cloud/vmware/v*|wc -l
echo -n ' VMware vSAN Python SDK: '
ag -H -il HAS_VSANPYTHONSDK lib/ansible/modules/cloud/vmware/v*|wc -l
@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