Skip to content

Instantly share code, notes, and snippets.

Working from home

Michele Baldessari mbaldessari

Working from home
View GitHub Profile
mbaldessari /
Created Jul 16, 2022
Toggle pipewire/pulseaudio output or input on/off
set -e
function error_out() {
echo "Error wrong arguments. Pick either input or output"
exit 1
if [ $# -ne 1 ]; then
mbaldessari / acm-import-cluster.yml
Created Feb 10, 2022
Playbook to import remote cluster in ACM
View acm-import-cluster.yml
# We require the kubernetes collection. Install it first via:
# ansible-galaxy collection install community.kubernetes
# This expects four environment variables to be set:
# KUBECONFIG -> Pointing to the HUB
# REMOTEAPI -> API endpoint of the remote cluster
# REMOTECLUSTERNAME -> Name of the cluster you want to import
# REMOTETOKEN -> Token of the remote cluster
- name: Playbook to import a cluster
View ovn-commands.txt
export SBDB=$(sudo ovs-vsctl get open . external_ids:ovn-remote | sed -e 's/\"//g') ; export NBDB=$(sudo ovs-vsctl get open . external_ids:ovn-remote
| sed -e 's/\"//g' | sed -e 's/6642/6641/g') ; alias ovn-sbctl='sudo podman exec ovn_controller ovn-sbctl --db=$SBDB' ; alias ovn-nbctl='sudo podman
exec ovn_controller ovn-nbctl --db=$NBDB' ; alias ovn-trace='sudo podman exec ovn_controller ovn-trace --db=$SBDB'
ovn-sbctl list chassis
ovs-vsctl get open . external_ids:ovn-bridge-mappings
ovn-nbctl --db="ssl:" -p /etc/pki/tls/private/ovn_controller.key -c /etc/pki/tls/certs/ovn_controller.crt -C /etc/ipa/ca.crt show
set -x
source /etc/os-release
sudo systemctl stop tripleo_\*
sudo systemctl stop ceph\*
sudo pcs cluster destroy
if [ $VERSION_ID == "7" ]; then
sudo docker ps -a -q | xargs docker rm -f
ospgrep() {
echo "$*"
grep -E "\s\b(E[rR]{2}:?|alert|Traceback|TRACE|crit|fatal|HANDLER|TASK|PLAY|Unexpected|FAIL|[Ff]ail|denied|non-zero|[Tt]ime[d\s]?out|UNCAUGHT|EXCEPTION|Unknown|[Aa]ssertion|inuse)" $*
rm /opt/puppetlabs/facter/cache/ -rf
rm -fr /var/lib/container-puppet/puppetlabs/
mkdir /var/lib/container-puppet/puppetlabs/
cat > /var/lib/container-puppet/puppetlabs/facter.conf <<EOF
facts : {
ttls: [
{ "kernel" : 98 hour },
{ "memory" : 98 hour },
{ "networking" : 98 hour },
{ "operating system" : 98 hour },
set -e
cd /home/stack
source ./stackrc
if [ ! -f inv.yml ]; then
tripleo-ansible-inventory --static-yaml-inventory inv.yml
cat > /tmp/sosreport.yml <<EOF
mbaldessari /
Created Oct 1, 2020
sosreport collection in parallel
set -ex
mkdir sosreports || /bin/true
declare -A pids
nodes=$(openstack --os-cloud undercloud server list -f value -c Networks |cut -f2 -d\=)
for i in $nodes; do
echo "Collecting for $i"
ssh $i 'sudo sosreport --quiet --batch; sudo chmod 644 /var/tmp/sos*xz' &
mbaldessari / gist:d356ef76d68ff8636a3d73b1cd968269
Last active Mar 17, 2020
Clean freeipa from spurious hosts
View gist:d356ef76d68ff8636a3d73b1cd968269
# To delete all hosts that are not freeipa and undercloud
# Go to freeipa-0 and open /tmp/freeipa-setup.env
# look for AdminPassword
kinit admin
# Type in AdminPassword
for i in $(ipa host-find |grep 'Host name:' | awk '{ print $3 }' | grep -v -e freeipa-0 -e undercloud-0 -e "ctlplane.$D" -e "$D" -e "internalapi.$D" -e "storage.$D" -e "storagemgmt.$D"); do ipa host-del "$i"; done
mbaldessari /
Created Sep 18, 2019
Disables other controller haproxy backends on osp ctlplane
set -e
# Before running this script it would be best to disable haproxy on the other nodes
# via: for i in controller-1 controller-2; do pcs resource ban haproxy-bundle $i; done
# To clear the bans: for i in controller-1 controller-2; do pcs resource clear haproxy-bundle $i; done
# Run this script as root on the single controller you want to stay active
# Enable admin access to the haproxy stat socket