Skip to content

Instantly share code, notes, and snippets.

su - pe-postgres -s '/bin/bash' -c '/opt/puppetlabs/server/bin/psql -d pe-puppetdb -c "select value,name,pg_column_size(value) from facts inner join fact_paths on fact_paths.id=facts.fact_path_id inner join fact_values on fact_values.id=facts.fact_value_id order by pg_column_size(value) desc limit 10;"' > /tmp/large_facts.txt
Compile master /agent
`curl -k https://<MoM_HOSTNAME>:8140/packages/current/install.bash | sudo bash -s main:dns_alt_names=<COMMA-SEPARATED LIST OF ALT NAMES FOR THE COMPILE MASTER>`
`curl -k https://pe-201732-master.puppetdebug.vlan:8140/packages/current/install.bash | sudo bash -s main:dns_alt_names=compile-master1,compile-master-dev
list user
curl https://$(puppet config print certname):4433/rbac-api/v1/users --cert $(puppet config print hostcert) --key $(puppet config print hostprivkey) --cacert $(puppet config print cacert) |python -m json.too
Create new user
curl -X POST -H 'Content-Type: application/json' --cert $(puppet config print hostcert) --key $(puppet config print hostprivkey) --cacert $(puppet config print cacert) https://$(head -n 1 /etc/puppetlabs/puppet/classifier.yaml |grep -oP "(?<=server: ).*"):4433/rbac-api/v1/users -d '{"login":"dbsadmin","email":"","display_name":"dbstestuser","role_ids": [1],"password":"dbstest"}'
Facter.add(:local_users) do
setcode do
users = Array.new
File.open("/etc/passwd").each do |line|
next if line.match(/^\s|^#|^$/)
users << line.split(':').first
end
# users.join(',')
users
end
@kkarthee
kkarthee / README.md
Created January 16, 2019 01:58 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
@kkarthee
kkarthee / README.md
Created January 16, 2019 01:58 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
@kkarthee
kkarthee / tmux.conf
Created May 8, 2020 02:20 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@kkarthee
kkarthee / get_running_process.py
Created September 17, 2024 16:09
fetch all the process and port details using python
import psutil
from pprint import pprint as pp
def get_running_process(proc_name,cmd_line):
import psutil
# """
# Gets a list of all running processes on the server.
#
# Returns:
@kkarthee
kkarthee / wls.py
Created September 17, 2024 16:12
check port and process details
import argparse
from pprint import pprint as pp
# from running_process import running_process
# import get_running_process
from get_running_process import get_running_process
### Argumnets where we passing the values as part of script )
arg_parser = argparse.ArgumentParser( description='This script helps to perform the given action on Weblogic node')
arg_parser.add_argument('--action',choices = ['running-proc','start','stop','restart','check'], required = True, help='Mention what action need to perform using this script')
arg_parser.add_argument('--env',choices = ['PROD','DEV'], required = True, help='Mention the environment name ')
args = arg_parser.parse_args()