This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| """ubuntu-namecheck 1.0.0 | Read-only host name resolution diagnostics for Ubuntu amd64. | |
| Requirements: Python 3.4+, glibc getent. No pip packages, dig, or root required. | |
| Examples and exit codes: ubuntu-namecheck.py --help | |
| """ | |
| import argparse | |
| import concurrent.futures | |
| import datetime | |
| import glob |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # ubuntu-dns-doctor.sh | |
| # | |
| # Read-only test and troubleshooting tool for name resolution on Ubuntu amd64. | |
| # Detects which resolver stack the release (and this particular machine) is | |
| # actually using, then walks every layer an application lookup passes through: | |
| # | |
| # application -> glibc NSS (/etc/nsswitch.conf "hosts:") | |
| # -> files (/etc/hosts) | myhostname | mdns4_minimal (avahi) | resolve |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if $(test -f /etc/landscape/landscape-server.crt);then | |
| landscape-config \ | |
| -k /etc/landscape/landscape-server.crt \ | |
| -t $(hostname -s) \ | |
| -u https://landscape.canonical.com/message-system \ | |
| --ping-url http://landscape.canonical.com/ping \ | |
| -a standalone \ | |
| -p lds-123456789-demo \ | |
| --http-proxy="" \ | |
| --https-proxy="" \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Set static IP configuration | |
| racadm setniccfg -s <IP_ADDRESS> <NETMASK> <GATEWAY> | |
| # Example: | |
| racadm setniccfg -s 192.168.1.100 255.255.255.0 192.168.1.1 | |
| # For DHCP instead: | |
| racadm setniccfg -d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import requests | |
| import json | |
| from requests.auth import HTTPBasicAuth | |
| import urllib3 | |
| # Disable SSL warnings if using self-signed certs | |
| urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
| # iDRAC credentials and current IP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export RACK=<MAAS_RACK_IP> | |
| export REGION=<MAAS_REGION_IP> | |
| Boot Files: | |
| ===================== | |
| curl -sSlL http://$RACK:5248/images/|awk -F'>|<' '/^<a href/{print $3,$5}' | |
| ## Test pulling static file via tftp (requires install tftp-hpa package): | |
| ### tftp -m binary $RACK -c get <filename from above> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pkgcmp() { | |
| for P in $(apt-cache search -n "${@}"|awk -F' - ' '{print $1}');do | |
| [[ -z ${P} ]] && { continue; }; | |
| printf "${P}: $(apt-cache show ${P}|awk '/^Section:/&&!/^$/{if ($2 !~ /\//) print "main";else {gsub(/\/.*/,"",$2);print $2}}')\n"; | |
| done | |
| };export -f pkgcmp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Create Directory | |
| mkdir -p ~/www | |
| # Enter directory | |
| cd ~/www | |
| # Create autoinstall.yaml | |
| cat > ~/www/user-data << 'EOF' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # prereqs: dnsutils jq | |
| # sudo apt install jq dnsutils -y | |
| geoip() { | |
| dig +short ${@}| \ | |
| xargs -rn1 -P1 bash -c \ | |
| 'curl -sSlL ipinfo.io/${0}|jq -r '"'"'"\(.hostname)\n\(.ip)\n\(.city)\n\(.region)\n\(.country)"'"'"'|paste -sd,'|\ | |
| sort -t, -k5V | |
| };export -f geoip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| export PAPI_DIR=~/papi | |
| [[ -d ${PAPI_DIR} ]] && { find ${PAPI_DIR} -type f -delete; } || { mkdir -p $PAPI_DIR; } | |
| export OK=$(printf '\e[0;1;38;2;0;255;0m✓\e[0m') | |
| export ORA=$(printf '\e[0;1;38;2;233;84;20m▸\e[0m') | |
| export WRA=$(printf '\e[0;1;38;2;255;255;255m▸\e[0m') | |
| printf "\n\e[2G\e[0;38;2;255;255;255mCanonical \e[0;38;2;233;84;20mPAPI\e[0m: Project and Package Information\e[0m\n" | |
| LINE="$(printf '\u2500%0.0s' {1..47})" | |
| printf "\e[2G${LINE}\n" |
NewerOlder