Skip to content

Instantly share code, notes, and snippets.

versionsix

Block or report user

Report or block versionsix

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@versionsix
versionsix / vagrant_inventory.py
Created Sep 11, 2018
Vagrant ansible dynamic inventory
View vagrant_inventory.py
#!/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 / vm_centos.json
Last active Aug 6, 2018
Ubuntu Azure ARM VM template
View vm_centos.json
{
"$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 / snippets.cson
Created Jul 18, 2018
atom ansible snippets
View snippets.cson
This file has been truncated, but you can view the full file.
'.source.ansible':
'a10_server':
'prefix': "a10_server_snippet"
'description': "Manage A10 Networks AX/SoftAX/Thunder/vThunder devices' server object."
'body': """
a10_server:
username: ${1:null} # required. An account with administrator privileges.
host: ${2:null} # required. Hostname or IP of the A10 Networks device.
password: ${3:null} # required. Password for the C(username) account.
@versionsix
versionsix / vagrant.py
Created Jul 18, 2018 — forked from lorin/vagrant.py
Vagrant dynamic inventory script for Ansible
View vagrant.py
#!/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 / rst_to_md.sh
Created Jul 17, 2018 — forked from zaiste/rst_to_md.sh
Convert RST to Markdown using Pandoc
View rst_to_md.sh
FILES=*.rst
for f in $FILES
do
filename="${f%.*}"
echo "Converting $f to $filename.md"
`pandoc $f -f rst -t markdown -o $filename.md`
done
@versionsix
versionsix / update_ubuntu1804_libvirt.sh
Last active Jul 16, 2018
Vagrant add local updated ubuntu version for libvirt provider
View update_ubuntu1804_libvirt.sh
#!/bin/bash
# Make sure libguestfs-tools package is installed (libguestfs-tools-c on EL)
# Make sure current user is in kvm group: sudo usermod $USER -g kvm OR sudo chmod 0666 /dev/kvm
# Based on https://scotch.io/tutorials/how-to-create-a-vagrant-base-box-from-an-existing-one
box=ubuntu1804
provider=libvirt
if [[ $EUID > 0 ]]; then
echo "Please run as root/sudo"
exit 1
@versionsix
versionsix / Vagrantfile
Last active Jul 14, 2018
Vagrant pfsense + guest vm.
View Vagrantfile
Vagrant.configure("2") do |config|
config.vm.define "pfsense" do |subconfig|
subconfig.vm.box = "kennyl/pfsense"
subconfig.vm.box_version = "2.4.0"
subconfig.vm.synced_folder ".", "/vagrant", disabled: true
subconfig.vm.network "private_network", virtualbox__intnet: "mynetwork", auto_config: false
subconfig.vm.network "forwarded_port", guest: 80, host: 8080
subconfig.vm.network "forwarded_port", guest: 443, host: 8443
subconfig.vm.network "forwarded_port", guest: 3000, host: 3000
subconfig.vm.provider :virtualbox do |vb|
@versionsix
versionsix / play.yml
Created Jul 13, 2018
Ansible dynamically generate ipam + inventory names based on single integer
View play.yml
---
- name: Auto create dictionary
hosts: [localhost]
connection: local
vars:
ansible_tower:
towers_amount: 3 # Make sure this is uneven
databases_amount: 1 # Make sure this is uneven
prefix: 172.17.202.64/26
tasks:
@versionsix
versionsix / async.yml
Created Jul 12, 2018
Ansible async task snippet
View async.yml
---
- hosts: localhost
connection: local
tasks:
- name: simulate long running op, allow to run for 16 sec, fire and forget
command: "/bin/sleep {{ item }}"
async: 16
register: my_async_job
poll: 0
loop: [1, 3, 15, 4]
@versionsix
versionsix / update_centos7.sh
Last active Jul 6, 2018
Vagrant add local updated centos7 image
View update_centos7.sh
#!/bin/bash
# Based on https://scotch.io/tutorials/how-to-create-a-vagrant-base-box-from-an-existing-one
mkdir -p centos7_box
cd centos7_box
touch Vagrantfile
cat << EOF > Vagrantfile
Vagrant.configure("2") do |config|
config.ssh.insert_key = false
config.vm.box = "centos/7"
You can’t perform that action at this time.