Skip to content

Instantly share code, notes, and snippets.

Avatar

carles san agustin carlessanagustin

View GitHub Profile
@carlessanagustin
carlessanagustin / keycloak.sh
Created Feb 14, 2021 — forked from paoloantinori/keycloak.sh
Keycloak Admin API Rest Example
View keycloak.sh
#!/bin/bash
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin" \
-d 'password=admin' \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
curl -X GET 'http://localhost:8080/auth/admin/realms' \
@carlessanagustin
carlessanagustin / docker-compose.yml
Created Jan 26, 2021
Simple Nginx via Docker Compose file
View docker-compose.yml
version: '3'
services:
webserver:
image: nginx:latest
command: [nginx-debug, '-g', 'daemon off;']
ports:
- "8080:80/tcp"
@carlessanagustin
carlessanagustin / functions.tf
Created Jan 20, 2021
Terraform functions by example
View functions.tf
##--------------------------
## Terraform: Functions ##
##--------------------------
## Open terraform console
terraform console
#######################
## Numeric Functions ##
#######################
@carlessanagustin
carlessanagustin / detect_os.sh
Created Jan 14, 2021
detect linux OS from packagecloud.io
View detect_os.sh
: '
thanks to https://packagecloud.io/
You can find a list of supported OSes and distributions on our website: https://packagecloud.io/docs#os_distro_version
'
detect_os_deb ()
{
if [[ ( -z "${os}" ) && ( -z "${dist}" ) ]]; then
# some systems dont have lsb-release yet have the lsb_release binary and
# vice-versa
@carlessanagustin
carlessanagustin / azure-pipeline.yaml
Last active Sep 16, 2020
Azure Pipeline basic infrastructure check
View azure-pipeline.yaml
trigger: none
pr: none
#pool:
stages:
- stage: infrastructure
displayName: infrastructure stage
#variables:
#condition:
jobs:
@carlessanagustin
carlessanagustin / test.dp.yaml
Created Sep 9, 2020
Simple Centos Deployment for Kubernetes
View test.dp.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: centos-dp
labels:
app: centos
spec:
replicas: 1
selector:
@carlessanagustin
carlessanagustin / pipeline.yaml
Created Sep 4, 2020
Azure Devops Pipeline predefined variables print
View pipeline.yaml
trigger:
branches:
include:
- master
- develop
- refs/tags/*
pool:
vmImage: 'ubuntu-18.04'
@carlessanagustin
carlessanagustin / ingress.yaml
Created Jul 28, 2020
Kubernetes Ingress path redirection
View ingress.yaml
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ingress-path
annotations:
kubernetes.io/ingress.class: internal
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/use-regex: "true"
spec:
rules:
@carlessanagustin
carlessanagustin / create_self_signed_certificate.sh
Last active Jun 3, 2020
Create SSL/TLS Certificate for Ingress Controller - wget -O - https://tinyurl.com/ybansmjf | bash -s 3650 default ingress-tls
View create_self_signed_certificate.sh
#!usr/bin/env bash
'''
USAGE:
wget -O - <URL> | \
bash -s <expiry_days> <namespace> <secret_name>
SOURCE:
https://www.learnitguide.net/2020/06/create-ssl-tls-certificate-ingress.html
@carlessanagustin
carlessanagustin / nginx.yaml
Last active Jun 4, 2020
Basic NGINX deployment to Kubernetes (hello world) | kubectl apply -f https://tinyurl.com/yc9bodwr
View nginx.yaml
# create...
# $ kubectl apply -f ./nginx.yaml
#
# delete...
# $ kubectl delete -f ./nginx.yaml
#
# monitor...
# $ watch kubectl -n nginx-test get pod,svc,endpoints,ingress,deployments,replicasets
#
# troubleshoot service...