Skip to content

Instantly share code, notes, and snippets.

@remoteur
remoteur / decloudify_image
Last active April 30, 2022 08:18
decloudify_image
yum install -y libguestfs-tools
virt-filesystems --long -h --all -a rhev-m.init.qcow2
truncate -r rhev-m.init.qcow2 rhev-m.qcow2
truncate -s +100G rhev-m.qcow2
virt-resize --expand /dev/sda1 rhev-m.init.qcow2 rhev-m.qcow2
virt-customize -a rhev-m.qcow2 --root-password password:<pass>
virt-customize -a rhev-m.qcow2 --run-command 'yum remove -y cloud-init'
virt-customize -a rhev-m.qcow2 --run-command 'sed -i s/^PasswordAuthentication.*/PasswordAuthentication\ yes/ /etc/ssh/sshd_config'
virt-customize -a rhev-m.qcow2 --run-command 'sed -i s/^PermitRootLogin.*/PermitRootLogin\ yes/ /etc/ssh/sshd_config'
@remoteur
remoteur / oc template examples
Last active December 1, 2021 15:14
oc template
./oc get pods -A --template '{{range .items}}{{if eq .status.phase "Running"}}{{.metadata.name}}{{"\n"}}{{end}}{{end}}'
oc get pods -A --template '{{range .items}}{{if and (ne .status.phase "Running") (ne .status.phase "Succeeded") }}{{.metadata.name}}{{"\n"}}{{end}}{{end}}'
@remoteur
remoteur / mount_qcow
Last active January 22, 2020 18:58
mount qcow
guestfish --rw -a rhcos-43.81.202001142154.0-qemu.x86_64.qcow2
><fs> run
><fs> mount /dev/sda1 /
gunzip rhcos-43.81.202001142154.0-qemu.x86_64.qcow2.gz
virt-edit -a rhcos-43.81.202001142154.0-qemu.x86_64.qcow2 -m /dev/sda1 -e "s/ip=dhcp/ip=ens3:dhcp6/g" /grub2/grub.cfg
sha256sum rhcos-43.81.202001142154.0-qemu.x86_64.qcow2
gzip rhcos-43.81.202001142154.0-qemu.x86_64.qcow2
sha256sum rhcos-43.81.202001142154.0-qemu.x86_64.qcow2.gz
@remoteur
remoteur / ios_tcl_871
Created September 27, 2015 14:08
Cisco IOS Tcl script for interacive configuration
ios_config "service password-encryption"
ios_config "no service config"
ios_config "line con 0" "logging synchronous"
puts -nonewline "Please enter the hostname of this box: "
flush stdout
set hostname [ gets stdin ]
puts -nonewline "Please enter the domain name of this box: "
flush stdout
set domain [ gets stdin ]
ios_config "ip domain name $domain"
@remoteur
remoteur / upgrade.sh
Last active September 26, 2019 22:31
openstack upgrade
systemctl stop 'openstack-*'
systemctl stop 'neutron-*'
systemctl stop 'openvswitch'
systemctl stop httpd
yum remove centos-release-ceph-luminous-1.1-2.el7.centos.noarch
yum install -y centos-release-openstack-stein
yum-config-manager --disable centos-release-openstack-rocky
@remoteur
remoteur / fix_mouse_scroll
Created April 14, 2019 15:26
fix_mouse_scroll
sudo sh -c "echo 0 > /sys/bus/usb/devices/1-4.4.2/authorized"
sudo sh -c "echo 1 > /sys/bus/usb/devices/1-4.4.2/authorized"
@remoteur
remoteur / ocp-inventory
Last active January 14, 2019 04:06
ocp-inventory
[OSEv3:children]
masters
nodes
etcd
[OSEv3:vars]
ansible_ssh_user=root
openshift_deployment_type=origin
openshift_master_identity_providers=[{ 'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider'}]
@remoteur
remoteur / ocp.repo
Last active January 14, 2019 02:07
ocp_repos
[ocp-3.11]
name=OpenShift 3.11
baseurl=https://cbs.centos.org/repos/paas7-openshift-origin311-release/$basearch//os/
enabled=1
gpgcheck=0
[ocp-common]
name=OpenShift 3.11 common
baseurl=https://cbs.centos.org/repos/paas7-openshift-common-candidate/$basearch//os/
enabled=1
[general]
# Path to a public key to install on servers. If a usable key has not
# been installed on the remote servers, the user is prompted for a
# password and this key is installed so the password will not be
# required again.
CONFIG_SSH_KEY=/root/.ssh/id_rsa.pub
# Default password to be used everywhere (overridden by passwords set
# for individual services or users).
@remoteur
remoteur / baremetal node list
Last active December 20, 2018 04:29
ocp tripleo
(undercloud) [stack@undercloud ~]$ openstack baremetal node list
+--------------------------------------+--------------------+---------------+-------------+--------------------+-------------+
| UUID | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+--------------------+---------------+-------------+--------------------+-------------+
| e5146164-5479-4aa2-b598-23cf4d203e5f | openshift-master-0 | None | power on | manageable | False |
| b8630617-70af-4c25-9601-283cbc7e24d1 | openshift-master-1 | None | power on | manageable | False |
| 21de991b-8a63-4f36-8911-02d6e1b2ed4d | openshift-master-2 | None | power on | manageable | False |
| f697d202-d710-47fa-bd5e-eea357433ade | openshift-infra-0 | None | power on | manageable | False |
| 35caf228-db29-4032-8c11-feadabc950fc | openshift-infra-1 | None