Skip to content

Instantly share code, notes, and snippets.

@sasg
sasg / main.yml
Created November 10, 2019 06:51 — forked from rothgar/main.yml
Generate /etc/hosts with Ansible
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']
@sasg
sasg / ipcalc.go
Created October 26, 2019 05:34 — forked from kotakanbe/ipcalc.go
get all IP address from CIDR in golang
package main
import (
"net"
"os/exec"
"github.com/k0kubun/pp"
)
func Hosts(cidr string) ([]string, error) {
@sasg
sasg / golang_struct_packed.go
Created October 14, 2019 18:50 — forked from longbuilder/golang_struct_packed.go
golang struct packed to network buffer
// struct filed only support uint* and string
// for string, there should be a value to represent the length of string
// packed
func WriteStructToBuffer(buffer *bytes.Buffer, data interface{}) error {
v := reflect.Indirect(reflect.ValueOf(data))
if v.Kind() != reflect.Struct {
return errors.New("invaild type Not a struct")
}
diff --git a/Makefile b/Makefile
index 00730a98..28d23f11 100644
--- a/Makefile
+++ b/Makefile
@@ -39,7 +39,7 @@ GOARM=7
# List images with gcloud alpha container images list-tags gcr.io/google_containers/kube-cross
KUBE_CROSS_TAG=v1.8.3-1
-IPTABLES_VERSION=1.4.21
+IPTABLES_VERSION=1.6.1
@sasg
sasg / dhcpd.conf
Created September 4, 2018 15:23 — forked from robinsmidsrod/dhcpd.conf
Trying to chainload iPXE with full feature set from a lesser featured one, whilst still being able to boot non-supported cards with UNDI
ddns-update-style none;
deny bootp; #default
authoritative;
include "/etc/dhcp/ipxe-option-space.conf";
# GREEN (private network)
subnet 10.1.1.0 netmask 255.255.255.0 {
range 10.1.1.100 10.1.1.199;
option subnet-mask 255.255.255.0;
@sasg
sasg / golang_job_queue.md
Created August 18, 2018 06:33 — forked from harlow/golang_job_queue.md
Job queues in Golang
@sasg
sasg / helm-cheatsheet.md
Created August 4, 2018 12:32 — forked from tuannvm/argo.md
#Helm #Kubernetes #cheatsheet, happy helming!
@sasg
sasg / k8s-pi.md
Created January 31, 2018 15:38 — forked from alexellis/k8s-pi.md
K8s on Raspbian

K8s on (vanilla) Raspbian Lite

Yes - you can create a Kubernetes cluster with Raspberry Pis with the default operating system Raspbian. Carry on using all the tools and packages you're used to with the officially-supported OS.

Pre-reqs:

  • You must use an RPi2 or 3 for Kubernetes
  • I'm assuming you're using wired ethernet (Wi-Fi also works)

Master node setup