Skip to content

Instantly share code, notes, and snippets.

View alexproca's full-sized avatar

Alex Proca alexproca

View GitHub Profile
@alexproca
alexproca / README.md
Created May 2, 2023 20:36 — forked from metmajer/README.md
Ansible Logging To Elasticsearch

Ansible Logging To Elasticsearch

Turns Ansible log outputs into plain JSON strings and sends them to an Elasticsearch cluster.

Place the script in your playbook's plugins/callbacks/ directory.

@alexproca
alexproca / README-setup-tunnel-as-systemd-service.md
Last active July 25, 2023 09:12 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
service salt-minion stop
rm -f /etc/salt/pki/minion/minion_master.pub
echo "master: salt" > /etc/salt/minion
service salt-minion start
@alexproca
alexproca / forticlientsslvpn-expect.sh
Created October 23, 2019 18:32 — forked from azizasm/forticlientsslvpn-expect.sh
Continuous run Forticlient VPN using expect. Automatically restart VPN if get disconnected or session closed.
#!/bin/bash
# Forticlient SSL VPN Client / expect
# --------------------------------------------
# CONFIGURATION
FORTICLIENT_PATH=""
DISPLAY=:0 xinput --set-prop 'FT5406 memory based driver' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1
echo "Public name: $(hostname)-incrementaltech.$(wget -qO- --header=Metadata:true 'http://instance-data/metadata/instance/compute/location?api-version=2017-04-02&format=text').cloudapp.azure.com";
echo "Public ip: $(wget -qO- --header=Metadata:true 'http://instance-data/metadata/instance/network/interface/0/ipv4/ipAddress/0/publicIpAddress?api-version=2017-04-02&format=text')";
echo "Local hostname: $(hostname)"
echo "Private ip: $(wget -qO- --header=Metadata:true 'http://instance-data/metadata/instance/network/interface/0/ipv4/ipAddress/0/privateIpAddress?api-version=2017-04-02&format=text')";
echo "Zone: $(wget -qO- --header=Metadata:true 'http://instance-data/metadata/instance/compute/location?api-version=2017-04-02&format=text')";
echo "Load: $(uptime | awk -F'[a-z]:' '{ print $2}')";
kubectl create clusterrolebinding user-admin-binding --clusterrole=cluster-admin --user=$(gcloud config get-value account)
kubectl create serviceaccount tiller --namespace kube-system
kubectl create clusterrolebinding tiller-admin-binding --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
kubectl create clusterrolebinding --clusterrole=cluster-admin --serviceaccount=default:default concourse-admin
helm init --service-account=tiller
#!/bin/bash
search_term=${1-local/}
helm update;helm search $search_term | sed -n '1!p' | awk -v login=$2 '{\
v_count=split($2, versionArray, ".");\
q_count=split(versionArray[3], qualifierArray, "-");\
qualifierArray[1]=qualifierArray[1]+1;\
qualifier=qualifierArray[1];\
for(i=2;i<=q_count;i++)\
@alexproca
alexproca / k8s-sa
Created September 23, 2018 10:36 — forked from mreferre/k8s-sa
Kubernetes Service Account
# Inspired by: https://stackoverflow.com/questions/42170380/how-to-add-users-to-kubernetes-kubectl
# this script creates a service account (user1) on a Kubernetes cluster (tested with AWS EKS 1.9)
# prereqs: a kubectl ver 1.10 installed and proper configuration of the heptio authenticator
# this has been tested on Linux in a Cloud9 environment (for MacOS the syntax may be slightly different)
**************************************************
******* Create an account *******
**************************************************
# Create service account for user user1
kubectl create sa user1
@alexproca
alexproca / pom.xml
Created September 6, 2018 18:51 — forked from dwelch2344/pom.xml
Executable WAR example via Tomcat Maven Plugin
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!-- Your stuff here... -->
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>