Skip to content

Instantly share code, notes, and snippets.

View versionsix's full-sized avatar
🦖
Using modern software.

Frank Meeusen versionsix

🦖
Using modern software.
  • Belgium, Antwerp
View GitHub Profile
@versionsix
versionsix / vm_centos.json
Last active August 6, 2018 09:53
Ubuntu Azure ARM VM template
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"dnsLabelPrefix": {
"type": "string",
"metadata": {
"description": "Unique DNS Name for the Storage Account where the Virtual Machine's disks will be placed."
}
},
@versionsix
versionsix / vagrant_inventory.py
Created September 11, 2018 14:33
Vagrant ansible dynamic inventory
#!/usr/bin/env python
# Adapted from Mark Mandel's implementation
# https://github.com/ansible/ansible/blob/devel/plugins/inventory/vagrant.py
import argparse
import json
import paramiko
import subprocess
import sys
@versionsix
versionsix / alpha.j2
Created November 28, 2018 10:35
Ansible nested template with loop and variable
Alpha-file
{% for student in students %}
{{ lookup('template','beta.j2') }}
{%endfor%}
configure
set firewall name WAN_LOCAL rule 100 action accept
set firewall name WAN_LOCAL rule 100 description 'Allow IKE for Remote VPN Server'
set firewall name WAN_LOCAL rule 100 destination port 500
set firewall name WAN_LOCAL rule 100 log enable
set firewall name WAN_LOCAL rule 100 protocol udp
set firewall name WAN_LOCAL rule 110 action accept
set firewall name WAN_LOCAL rule 110 description 'Allow L2TP for Remote VPN Server'
set firewall name WAN_LOCAL rule 110 destination port 1701
@versionsix
versionsix / install.sh
Created January 23, 2019 18:35
Install gitlab ubuntu1804
#!/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 / libvirt-tf-dummy.tf
Created January 29, 2019 15:59
libvirt-tf-dummy.tf
provider "libvirt" {
uri = "test:///default"
}
resource "libvirt_domain" "terraform_test" {
name = "terraform_test"
}
@versionsix
versionsix / install-netbox.sh
Last active March 7, 2019 14:10
Install netbox in one go
#!/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 / legacy_free.sh
Created March 9, 2019 15:16
legacy free qcow2 images
#!/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 / legacy-free-ubuntu.sh
Created August 7, 2019 11:09
Legacy free openstack images
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/"