Skip to content

Instantly share code, notes, and snippets.

View RahulMahale's full-sized avatar
🏠
Working from home

Rahul Mahale RahulMahale

🏠
Working from home
View GitHub Profile
@RahulMahale
RahulMahale / groovy-create-user.md
Created August 6, 2021 09:14 — forked from hayderimran7/groovy-create-user.md
Jenkins Groovy enable security and create a user in groovy script

This is a snippet that will create a new user in jenkins and if security has been disabled , it will enable it :)

import jenkins.model.*
import hudson.security.*

def instance = Jenkins.getInstance()

def hudsonRealm = new HudsonPrivateSecurityRealm(false)
hudsonRealm.createAccount("MyUSERNAME","MyPASSWORD")
instance.setSecurityRealm(hudsonRealm)
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql
spec:
replicas: 1
selector:
matchLabels:
app: mysql
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
#!/bin/bash
rvm reset
rvm uninstall 2.2.7
rvm implode --force
sed -i '/rvm/d' ~/.bash_profile
sed -i '/rvm/d' ~/.profile
sed -i '/rvm/d' ~/.bashrc
sudo mv /usr/local/rvm /tmp/
cd ~/
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
echo "gem: --no-document" > ~/.gemrc
gem install bundler

kubectl exec -p <pod-name> -i -t -- bash -il

Find all the files with extension recursively

find . -name \*.txt -print

Reconfigure networking for the lxc containers to assign IP address.

sudo dpkg-reconfigure -p medium lxd

####If you are using AWS ELB and nginx as an web server,
####to enable the access logs with details add the following diriectives to your nginx configuration
real_ip_header X-Forwarded-For;
set_real_ip_from 10.70.0.0/16;