Skip to content

Instantly share code, notes, and snippets.

View goneri's full-sized avatar
🇺🇦

Gonéri Le Bouder goneri

🇺🇦
View GitHub Profile
#!/bin/bash
# I use to work on different tasks and I like to know quickly if something is finished.
# With this script, I can shoot a long command (e.g: an OpenStack deployment) and focus
# on something else.
$*
if [ $? -eq 0 ]; then
status="SUCCESS"
icon=dialog-information
else
status="FAILURE"
#!/bin/bash
for i in $(ls /sys/class/net/); do
echo -n "${i}: "
firewall-cmd --get-zone-of-interface=${i}
done
dcictl --format json job-list --where remoteci_id:4f8faddd-102b-400b-b295-e648501d16f8 --limit 50|jq '.jobs[]|select(.jobdefinition.name|contains("OSP 10"))| .id')
@goneri
goneri / ironic_bm_from_a_undercloud.sh
Created September 12, 2017 20:26
Ironic BM from the undercloud
set -eux
function cleanup() {
openstack server list -f value -c ID|xargs -r -n1 openstack server delete --wait
openstack flavor show rhcert && openstack flavor delete rhcert
openstack baremetal list -f value -c UUID|xargs -r -n1 openstack baremetal delete
}
cleanup
openstack flavor create --ram 1024 --disk 20 --vcpus 1 rhcert
# To list the capability of a pool ID:
curl -v -u foo:bar -k https://subscription.rhn.redhat.com/subscription/pools/8a85f98260c27fc50160c323263339ff|jq .
# See: https://access.redhat.com/documentation/en-us/red_hat_subscription_management/1/html/red_hat_subscription_management_integration_guide/examples2
# find a pool id with "Red Hat Certificate System"
subscription-manager attach --pool THE_ID
subscription-manager repos '--disable=*' --enable=rhel-7-server-rpms --enable=rhel-7-server-optional-rpms --enable=rhel-7-server-extras-rpms --enable=rhel-7-server-openstack-10-rpms --enable=rhel-7-server-cert-rpms
yum install -y redhat-certification
rhcertd start
systemctl restart httpd
@goneri
goneri / cinder-debug-mode.sh
Last active March 27, 2018 16:48
RHOSP debug mode
for i in $(openstack server list --format json|jq -r '.[].Networks'); do
eval $i
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no heat-admin@${ctlplane} sudo sudo crudini --set /etc/cinder/cinder.conf DEFAULT debug True
done
@goneri
goneri / drop dell keys
Created March 28, 2018 15:40
clean up instackenv.json
+cat ~/instackenv.json|jq '.nodes| {nodes: map(del (.service_tag)|del (.model)|del (.provisioning_mac))}' > /tmp/clean_instackenv.json
@goneri
goneri / dci_get_last_component.sh
Created April 4, 2018 17:33
DCI: Fetch the last component for a given topic
#!/bin/bash
if [ -z $1 ]; then
echo "Usag: $0 tag_name"
exit 1
fi
tag_name=$1
tag_id=$(dcictl --format json topic-list --where name:${tag_name}|jq -r '.topics[0].id')
component_id=$(dcictl --format json component-list --topic-id ${tag_id} --limit 1|jq -r .components[0].id)
component_name=$(dcictl --format json component-list --topic-id ${tag_id} --limit 1|jq -r .components[0].name)
@goneri
goneri / os-net-config-convert
Last active May 4, 2018 18:01
convert os-net-config template to the new format (OSP10 to OSP13)
#!/bin/env python
import argparse
import yaml
parser = argparse.ArgumentParser()
parser.add_argument('old_template', type=open, help='The old NIC template')
ns = parser.parse_args()
data = yaml.load(ns.old_template.read())
osnetcfgimpt = data['resources']['OsNetConfigImpl']