Skip to content

Instantly share code, notes, and snippets.

@versionsix
versionsix / pa-example-config.xml
Created Nov 14, 2019
Palo alto example config. mgmt: 192.168.123.99/24 admin | P@ssw0rd
View pa-example-config.xml
<config version="8.0.0" urldb="paloaltonetworks">
<mgt-config>
<users>
<entry name="admin">
<phash>$1$l2.doqhj$Vri/RkbGRnVW2yjB.xV6O0</phash>
<permissions>
<role-based>
<superuser>yes</superuser>
</role-based>
</permissions>
@versionsix
versionsix / cloud-init.cfg .yaml
Last active Nov 26, 2020
[Cloud-Init] User-Data for auto root login
View cloud-init.cfg .yaml
%YAML 1.2
---
#cloud-config
disable_root: false
ssh_pwauth: True
chpasswd:
list: |
root:toor
expire: False
users:
@versionsix
versionsix / legacy-free-ubuntu.sh
Created Aug 7, 2019
Legacy free openstack images
View legacy-free-ubuntu.sh
wget -O /var/lib/libvirt/images/ubuntu-bionic.qcow2 https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img
cat <<EOF > 51-vga.cfg
GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0 vga=789"
EOF
virt-copy-in -a /var/lib/libvirt/images/ubuntu-bionic.qcow2 51-vga.cfg /etc/default/grub.d
virt-customize -v -a /var/lib/libvirt/images/ubuntu-bionic.qcow2 \
--run-command "update-grub" \
--run-command "apt -yqq update && apt -yqq upgrade" \
--run-command "apt -y -qq --no-install-recommends install jq dnsutils && apt -y autoremove" \
--run-command "mkdir -p /etc/systemd/system/getty@tty1.service.d && mkdir -p /etc/systemd/system/serial-getty@ttyS0.service.d && mkdir -p /etc/cloud/cloud.cfg.d/"
@versionsix
versionsix / legacy_free.sh
Created Mar 9, 2019
legacy free qcow2 images
View legacy_free.sh
#!/bin/bash
DATE=`date +%Y%m%d`
DATE='latest'
IMAGES_DIR='/var/lib/libvirt/images'
CLOUDIMAGE_FEDORA29='https://download.fedoraproject.org/pub/fedora/linux/releases/29/Cloud/x86_64/images/Fedora-Cloud-Base-29-1.2.x86_64.qcow2'
CLOUDIMAGE_UBUNTU1804='https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img'
CLOUDIMAGE_CENTOS7='https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2c'
CLOUDIMAGE_DEBIAN='http://cdimage.debian.org/cdimage/openstack/current-9/debian-9-openstack-amd64.qcow2'
dnf -qy install bridge-utils libvirt virt-install qemu-kvm libguestfs-tools cloud-utils python-glanceclient python-openstackclient jq
# Fedora Images
@versionsix
versionsix / compile_kernel.sh
Last active Apr 23, 2019
Compile linux 5.0 kernel benchmark
View compile_kernel.sh
#!/bin/bash
mv /root/logs.txt /root/logs_`date +%s`.txt 2>/dev/null || true
exec &> >(tee -a "/root/logs.txt")
systemctl restart systemd-timesyncd
start_time=`date +%s`
export DEBIAN_FRONTEND=noninteractive
echo "==========================================="
echo " UPDATE SYSTEM"
echo "==========================================="
start_time_update=`date +%s`
View libvirt-tf-dummy.tf
provider "libvirt" {
uri = "test:///default"
}
resource "libvirt_domain" "terraform_test" {
name = "terraform_test"
}
@versionsix
versionsix / install-netbox.sh
Last active Mar 7, 2019
Install netbox in one go
View install-netbox.sh
#!/bin/bash
# install:
# NETBOX_FQDN=netbox.example.com bash -c "$(curl -Lso- https://git.io/fhp1D)"
export DEBIAN_FRONTEND=noninteractive
systemctl restart systemd-timesyncd
ipv6="${ipv6:-$( wget -qO- -t1 -T2 ipv6.icanhazip.com)}"
ipv4="${ipv4:-$( wget -qO- -t1 -T2 ipv4.icanhazip.com)}"
ipv4_slug="$(echo $ipv4 | sed 's/\./-/g').nip.io"
random_dbpass=`date +%s | sha256sum | base64 | head -c 32`
random_nbpass=`date +%s | sha256sum | base64 | head -c 32`
@versionsix
versionsix / install.sh
Created Jan 23, 2019
Install gitlab ubuntu1804
View install.sh
#!/bin/bash
DEBIAN_FRONTEND=noninteractive apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y curl openssh-server ca-certificates
DEBIAN_FRONTEND=noninteractive apt-get install -y postfix unattended-upgrades
# on centos use yum-cron instead of unattended-upgrades
cat <<'EOF' > /etc/apt/apt.conf.d/50unattended-upgrades
Unattended-Upgrade::Allowed-Origins {
"${distro_id}:${distro_codename}";
"${distro_id}:${distro_codename}-security";
@versionsix
versionsix / alpha.j2
Created Nov 28, 2018
Ansible nested template with loop and variable
View alpha.j2
Alpha-file
{% for student in students %}
{{ lookup('template','beta.j2') }}
{%endfor%}
You can’t perform that action at this time.