Skip to content

Instantly share code, notes, and snippets.

---
- name: "Log in to OKD"
k8s_auth:
host: "{{ okd_hostname }}"
username: "{{ lookup('hashi_vault', 'secret=secret/user-name:value') }}"
password: "{{ lookup('hashi_vault', 'secret=secret/user-password:value') }}"
register: k8s_auth_results
- name: "Set API key"
set_fact:
@jbek7
jbek7 / kube-config.yaml
Created April 18, 2020 23:23
kube-config-template-okd
apiVersion: v1
clusters:
- cluster:
server: {{okd_hostname}}
name: my-cluster
contexts:
- context:
cluster: my-cluster
namespace: my-namespace
user: my-user
@jbek7
jbek7 / b-config.yaml
Created March 25, 2020 14:40
b-config.yaml
---
some:
other:
config: value
with-some: details
@jbek7
jbek7 / cleanup.sh
Created June 13, 2019 08:31 — forked from superseb/cleanup.sh
Cleanup host added as custom to Rancher 2.0
#!/bin/sh
docker rm -f $(docker ps -qa)
docker volume rm $(docker volume ls -q)
cleanupdirs="/var/lib/etcd /etc/kubernetes /etc/cni /opt/cni /var/lib/cni /var/run/calico /opt/rke"
for dir in $cleanupdirs; do
echo "Removing $dir"
rm -rf $dir
done
---
apiVersion: v1
kind: ConfigMap
metadata:
creationTimestamp: null
name: my-configmap
data:
a-config.yaml: |
{{ a_config_path | to_yaml_preserve_order | indent }}
bconfig.yaml: |
@jbek7
jbek7 / myfilter.py
Last active April 20, 2019 20:00
Custom Jinja filter for nice order preserved YAML
#!/usr/bin/python
import oyaml as yaml
import os
class FilterModule(object):
def filters(self):
return {
'to_yaml_preserve_order': self.to_yaml_preserve_order
}
@jbek7
jbek7 / a-config.yaml
Last active March 25, 2020 14:39
App configs
---
foo:
bar:
baz: qux
quux: quuz
corge: grault
garply: waldo
@jbek7
jbek7 / .k8s--configmap-output.yaml
Last active April 20, 2019 20:07
.k8s--configmap-output.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: my-configmap
data:
a-config.yaml: |
foo:
bar: {baz: qux, quux: quuz}
corge: grault
garply: waldo
@jbek7
jbek7 / playbook.yaml
Last active April 20, 2019 19:39
Ansible K8S ConfigMap generation
---
- name: Generate configmap k8s
template: src=templates/configmap.yaml dest=.k8s/configmap-output.yaml
vars:
- a_config_path: "config/a-config.yaml"
- b_config_path: "config/b-config.yaml"
- name: Apply configmap
k8s:
state: present
@jbek7
jbek7 / script.py
Last active February 5, 2019 00:52
Telegram Auto Replier
import time
from telethon import sync, TelegramClient, events
# sample API_ID from https://github.com/telegramdesktop/tdesktop/blob/f98fdeab3fb2ba6f55daf8481595f879729d1b84/Telegram/SourceFiles/config.h#L220
# or use your own
api_id =
api_hash = ''
# fill in your own details here
phone = '+yourphone'