Skip to content

Instantly share code, notes, and snippets.

View lrivallain's full-sized avatar
🏠
Working from home

Ludovic Rivallain lrivallain

🏠
Working from home
View GitHub Profile
#!/bin/bash
# Update packages list
apt-get update
# Install a web server
apt-get install -qqy apache2
# Hello world in instance's logs
echo "HELLO WORLD, I AM THE POST CONFIGURATION SCRIPT :)"
@lrivallain
lrivallain / BuildNewOSLab_Example.sh
Last active September 2, 2018 16:10
Helper to deploy openstack-based lab for training practical exercice
# Following command will create:
# * instance(s) named "training"
# * based on ubuntu image
# * start 10* instances
# * append index starting from 1
# * 5Gb disk per instance
# * sizing based on flavor: m1.tiny
# * connected to network: training_net
# * security group applied: training_sec
# * ssh key will be: mysshkey
@lrivallain
lrivallain / FileHash.ps1
Created March 7, 2017 10:32
Get FileHash on powershell (including PowerShell <v4)
# Return the hash of a Hash
# Ex:
# Get_FileHash .\path\to\file sha256
# Get_FileHash -File .\path\to\file -Hash sha256
function Get_FileHash(){
param(
[string[]]$File,
[string[]]$Hash
)
$availableHashMethods=@("MD5","SHA1","SHA256","SHA384","SHA512","RIPEM160")
@lrivallain
lrivallain / get-ovfenv.py
Last active November 3, 2023 06:35
This script retrieves informations from guestInfo.ovfEnv and print the OVF properties. In second time, it use OVF properties to reset the root password.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script retrieves information from guestInfo.ovfEnv and
print the OVF properties.
In second time, it use OVF properties to reset the root password.
"""
import subprocess
### Keybase proof
I hereby claim:
* I am lrivallain on github.
* I am lrivallain (https://keybase.io/lrivallain) on keybase.
* I have a public key whose fingerprint is CBF2 D0FF 5BDF 1CF8 5094 4C05 C6BE 80D9 44DB 4587
To claim this, I am signing this object:
<#
.SYNOPSIS
Windows 8 and Windows 2012 Server or later virtual machines fail upon reboot (2092807)
https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2092807
Resolution: To _work around_ this issue, update the VM advanced configuration to add monitor_control.enable_softResetClearTSC = TRUE
.NOTES
Author : Ludovic Rivallain
Version : 1.0
@lrivallain
lrivallain / 5.5_resetInventoryServiceDb.sh
Last active August 19, 2016 09:56
VMware | vcenter appliance - reset inventory service database
#### Configure
VCIP="10.0.0.1"
####
# stop IS service
service vmware-inventoryservice stop
# remove old DB
rm -rf /storage/db/inventoryservice/data
# create new DB
/usr/lib/vmware-vpx/inventoryservice/scripts/ds-invoke.sh -Dvim.logdir=/var/log/vmware/vpx/inventoryservice com.vmware.vim.dataservices.CreateDb /storage/db/inventoryservice/data changeme default changeme
@lrivallain
lrivallain / ics-notifier.conf.json
Last active August 27, 2015 16:38
A simple ICS events notifier by email
{
"url": "http://an/ics/file/uri.ics",
"mailfile": "/tmp/ics-notifier.email.txt",
"subject": "Évènement",
"tzone": "Europe/Paris",
"mails": [
"email1@example.com",
"email2@example.com"
]
}
@lrivallain
lrivallain / GuestInfoCustomization.ps1
Last active August 8, 2016 03:13
This script inserts guestinfo to a VM configuration parameters. "guestinfo" settings can be read from Guest OS in order to customize network settings for example.
# load PowerCli Snapin
if ((Get-PSSnapin -Name VMware.Vimautomation.Core -ErrorAction SilentlyContinue) -eq $null ) {
Add-PsSnapin VMware.Vimautomation.Core
}
# vCenter server
$VC = "vcenter.domain"
$Username = "domain\user"
# connecting vCenter
@lrivallain
lrivallain / addDatastoreToESXiCluster.ps1
Last active August 29, 2015 14:04
Add a new datastore to a set of ESXi based on cluster membership
Add-PSSnapin VMware.VimAutomation.Core
$vcenter='127.0.0.1'
$cluster='A_cluster_name'
$datastorename='A_datastore_name'
$nfshost='10.0.0.1'
$nfspath='/vol/a_vol_name/a_qtree'
Connect-VIServer $vcenter
Get-Cluster -Name $cluster | Get-VMHost | New-Datastore -Nfs -Name $datastorename -Path $nfspath -NfsHost $nfshost