Skip to content

Instantly share code, notes, and snippets.

@asc-adean
asc-adean / azure-keyvault-backup-different-subscriptions.sh
Created May 8, 2020 18:21
Azure Backup/Restore Keyvault Scripts
#!/bin/bash
# Make sure you are logged into the correct context via `az account set`
# Make sure you also delete the tmp folder as those secrets will be sitting on your filesystem in plain text!!!!!!!!!
vault_name=$1
if [[ -z $vault_name ]]; then
echo "Please supply vault name as an argument to this script"
#!/bin/bash
# Slack incoming web-hook URL and user name
url=$1 # example: url='https://hooks.slack.com/services/QW3R7Y/D34DC0D3/BCADFGabcDEF123'
username='Zabbix'
## Values received by this script:
# To = $1 / Slack channel or user to send the message to, specified in the Zabbix web interface; "@username" or "#channel"
# Subject = $2 / subject of the message sent by Zabbix; by default, it is usually something like "(Problem|Resolved): Lack of free swap space on Zabbix server"
# Message = $3 / message body sent by Zabbix; by default, it is usually approximately 4 lines detailing the specific trigger involved
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.jenkins.slave</string>
<key>UserName</key>
<string>build</string>
<key>ProgramArguments</key>
<array>
@asc-adean
asc-adean / secrets.py
Last active June 21, 2019 15:31
Grabs all secrets from Azure Key Vault for a Kubernetes secret yaml creation
from azure.keyvault import KeyVaultClient
from azure.common.credentials import ServicePrincipalCredentials
import re
import argparse
import json
import yaml # use pyyaml please
import base64
# Ensure the account you are pulling these secrets as has at *least* Read permissions on the Key Vault (check IAM)
@asc-adean
asc-adean / aks-cluster-create.ps1
Last active March 20, 2019 15:32
Azure AKS Kubernetes Cluster Create Powershell with RBAC and AAD Enabled
## This assumes you have created your 3 service principals and given them proper access
# https://docs.microsoft.com/en-us/azure/aks/aad-integration
# General infrastructure
$rg = "Name_of_Your_Resource_Group"
$tenant_id = "Tenant_ID_GUID"
$subscription_id = "Subscription_ID_GUID"
$ssh_pubkey = "ssh-rsa your_public_key"
$ssh_root_user_name = "username_for_shelling_in_do_not_use_root"
$location = "valid_azure_location"
@asc-adean
asc-adean / get-k8s-external-ips.py
Last active March 14, 2019 20:17
Kubernetes Discover External IPs
## If running in an RBAC-enabled cluster, the `default` service account in that namespace must have the following role,
## taking note to update the namespace: value
#---
# apiVersion: rbac.authorization.k8s.io/v1
# kind: Role
# metadata:
# name: default
# namespace: $NAMESPACE
# rules:
@asc-adean
asc-adean / rasavm.sh
Last active January 9, 2019 20:16
NLU VM Setup
#!/bin/bash
# Yum update and install necessary packages
sudo yum update -y
sudo yum install yum-utils -y
sudo yum groupinstall development -y
sudo yum install https://centos7.iuscommunity.org/ius-release.rpm -y
for removePackage in $(rpm -qa | grep maria)
do