Skip to content

Instantly share code, notes, and snippets.

View perfecto25's full-sized avatar

mrx perfecto25

  • NYC
View GitHub Profile
@perfecto25
perfecto25 / Debian.yaml
Created November 23, 2015 17:46
Hiera troubleshoot
# /etc/puppetlabs/puppet/hieradata/
---
domain_name: debian.corp.com
@perfecto25
perfecto25 / gist:dcbb50a81b91956065217b76804df866
Created May 16, 2016 21:00
PuppetServer shutdown on FileSync
2016-05-16 16:50:08,802 INFO [main] [o.e.j.u.log] Logging initialized @79620ms
2016-05-16 16:50:22,699 INFO [async-dispatch-2] [p.t.s.w.jetty9-service] Initializing web server(s).
2016-05-16 16:50:23,031 INFO [async-dispatch-2] [p.e.s.f.file-sync-storage-core] Initializing file sync server data dir: /opt/puppetlabs/server/data/puppetserver/filesync/storage
2016-05-16 16:50:23,043 INFO [async-dispatch-2] [p.e.s.f.file-sync-storage-core] Initializing Git repository at /opt/puppetlabs/server/data/puppetserver/filesync/storage/puppet-code.git
2016-05-16 16:50:23,321 INFO [async-dispatch-2] [p.e.s.f.file-sync-storage-service] File sync storage service mounting repositories at /file-sync-git
2016-05-16 16:50:23,706 INFO [async-dispatch-2] [p.e.s.f.file-sync-storage-service] Registering file sync storage HTTP API
2016-05-16 16:50:23,713 INFO [async-dispatch-2] [p.t.s.s.status-service] Registering status callback function for file-sync-storage-service service
2016-05-16 16:50:23,747 INFO [async-dispatch-2] [
at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64) ~[puppet-server-release.jar:na]
at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_101]
2016-08-24 11:10:28,271 WARN [qtp1808023046-59] [puppetserver] Puppet Error connecting to entap6441.giftcert.local on 8081 at route /pdb/cmd/v1?checksum=e31c9a403e4e76da070b6193aea5a4bab93618f7&version=4&certname=entap6441.giftcert.local&command=replace_facts, error message received was 'Error executing http request'. Failing over to the next PuppetDB server_url in the 'server_urls' list
2016-08-24 11:10:28,272 ERROR [qtp1808023046-59] [puppetserver] Puppet Failed to execute '/pdb/cmd/v1?checksum=e31c9a403e4e76da070b6193aea5a4bab93618f7&version=4&certname=entap6441.giftcert.local&command=replace_facts' on at least 1 of the following 'server_urls': https://entap6441.giftcert.local:8081
2016-08-24 11:10:28,273 ERROR [qtp1808023046-59] [puppetserver] Puppet /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/ut
ERROR -> Unable to determine current branches for Git source 'puppet' (/etc/puppetlabs/code-staging/environments)
Original exception:
Failed to authenticate SSH session: Unable to extract public key from private key file: Wrong passphrase or invalid/unrecognized private key file format at /opt/puppetlabs/server/data/code-manager/git/git@XYZ-control.git
REST API
### Artifactory ####
deploy artifact using REST
curl -u myUser:myP455w0rd! -X PUT "http://localhost:8081/artifactory/my-repository/my/new/artifact/directory/file.txt" -T Desktop/myNewFile.txt
query artifacts by Repo and Path
curl -u user:pw -X POST -k http://mrxartifactory:8081/artifactory/api/search/aql -d "items.find({\"type\" : \"file\",\"\$and\":[{\"repo\" : {\"\$match\" : \"myRepo*\"}, \"path\" : {\"\$match\" : \"myPkg*\"} }]}).include(\"name\",\"repo\",\"path\",\"size\")"
@perfecto25
perfecto25 / vault
Created March 16, 2017 16:15
Hashicorp Vault startup script for Centos/RHEL 6 / Fedora (/etc/init.d/vault)
#!/bin/bash
# chkconfig: 2345 80 05
# description: VAULT startup script
application="vault"
run_as_user="root"
port=8200
curr_user=$(whoami)
# stderr
@perfecto25
perfecto25 / consul
Created March 17, 2017 18:27
Consul startup script (bootstrap server)
#!/bin/bash
# chkconfig: 2345 80 05
# description: CONSUL startup script
application='consul'
run_as_user='root'
port=8300
curr_user=$(whoami)
ip=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | grep 192)
datacenter='mrx'
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This script downloads scan reports from Nessus as .csv files
'''
import requests, json, sys, os, csv, time
# disable SSL warnings
@perfecto25
perfecto25 / Jira API - Bash
Last active January 30, 2023 09:58
Jira API examples
# get all Custom fields on Jira server
curl -D- -u user:password -X GET -H "Content-Type: application/json" https://jira.instance.com/rest/api/2/field
# get JSON output of an issue
curl -D- -u user:password -X GET -H "Content-Type: application/json" https://jira.instance.com/rest/api/2/search?jql=key=INFO-68
# make 2 issues linked to each other
curl -u user:password -w '<%{http_code}>' -H 'Content-Type: application/json' https://jira.instance.com/rest/api/2/issueLink -X POST --data '{"type":{"name":"Related Incident"},"inwardIssue":{"key":"ISS-123"},"outwardIssue":{"key":"SYS-456"}}'
@perfecto25
perfecto25 / pkg_jira.sh
Last active September 25, 2017 15:48
Atlassian Jira RPM packager
#!/bin/bash
' This script packages atlassian Jira as an RPM
Prerequisites:
1. install Jira from .bin installer locally on the machine you are packaging from, choose Advanced Setup
configure install path, port, etc. Once install is complete, copy the $INSTALL_DIR/.install4j/response.varfile to
same directory where you are running this script from. This file is used for silent installs
2. Copy the Jira startup script to your /etc/init.d/ dir, name it "jira"
3. to create the Jira RPM, run this script ./pkg_jira.sh
4. FPM will generate the RPM and attempt to upload it to your Artifactory path
'