Skip to content

Instantly share code, notes, and snippets.

@ryanvgates
ryanvgates / shell.sh
Created August 24, 2021 20:06
Swift V3 Authenticate
ryan@server:~$ curl -i -X POST https://swift.server.com/auth/v3/auth/tokens -d '{"auth":{"identity":{"methods":["password"],"password":{"user":{"name":"user","domain":{"name":"Default"},"password":"password"}}}}}'
HTTP/1.1 200 OK
X-Subject-Token: AUTH_txe5555555555555555555555555555555
Content-Length: 1152
Content-Type: application/json; charset=UTF-8
X-Trans-Id: txe55555555555555555555-5555555555
X-Openstack-Request-Id: txe55555555555555555555-5555555555
Date: Tue, 24 Aug 2021 19:59:09 GMT
{
@ryanvgates
ryanvgates / output.txt
Last active August 5, 2021 17:14
Vault Cache Gotcha
..[ryan@server] - [~/Downloads/dev] - [Thu Aug 05, 09:46]
..[$] <()> export VAULT_ADDR=https://vault.server.com:8200
..[ryan@server] - [~/Downloads/dev] - [Thu Aug 05, 09:46]
..[$] <()> vault login -method=cert -client-cert=my-cert.pem -client-key=my-cert-key.pem
Error authenticating: Error making API request.
URL: PUT https://vault.server.com:8200/v1/auth/cert/login
Code: 400. Errors:
* error performing token check: failed to look up namespace from the token: no namespace
@ryanvgates
ryanvgates / get_status.sh
Created May 10, 2021 20:54
Status report in TeamCity
curl -H "Accept: application/json" http://mysite.com/status/ | jq . | tee status.txt
@ryanvgates
ryanvgates / mongorestore.sh
Created May 5, 2021 21:49
Rename MongoDB With Restore
mongorestore --dryRun -v --gzip --uri="mongodb://user:[email protected]:27017,replicaset-1-1.com:27017,replicaset-1-2.com:27017/new_db_name?authSource=new_db_name&replicaSet=resp1&ssl=true" --nsInclude=old_db_name.* --nsTo=new_db_name.* --nsFrom=old_db_name.* --ssl --archive={filename from above}
@ryanvgates
ryanvgates / mongodump.sh
Created May 5, 2021 21:48
Rename MongoDB With Restore
mongodump --gzip --archive=$(date +"%Y_%m_%d-%H_%M_%S")_dbname --ssl --uri="mongodb://user:[email protected]:27017,replicaset-1.com:27017,replicaset-2.com:27017/old_db_name?authSource=old_db_name&replicaSet=resp1&ssl=true"
@ryanvgates
ryanvgates / error.log
Created May 5, 2021 17:27
Ansible Dependency Gotcha
fatal: [host]: FAILED! => {
"changed": false,
"module_stderr": "Shared connection to host closed.\r\n",
"module_stdout": "Traceback (most recent call last):\r\n File \"/home/centos/.ansible/tmp/ansible-tmp-1573758290.699043-238093852151220/AnsiballZ_yum.py\", line 113, in \r\n ansiballz_main()\r\n File \"/home/centos/.ansible/tmp/ansible-tmp-1573758290.699043-238093852151220/AnsiballZ_yum.py\", line 105, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/home/centos/.ansible/tmp/ansible-tmp-1573758290.699043-238093852151220/AnsiballZ_yum.py\", line 48, in invoke_module\r\n imp.load_module('main_', mod, module, MOD_DESC)\r\n File \"/tmp/ansible_yum_payload_Pya32A/_main_.py\", line 320, in \r\n File \"/tmp/ansible_yum_payload_Pya32A/ansible_yum_payload.zip/ansible/module_utils/urls.py\", line 97, in \r\n File \"/usr/lib/python2.6/site-packages/requests/_init_.py\", line 114, in \r\n from .models import Request, Response, PreparedRequest\r\n File \"
@ryanvgates
ryanvgates / concourse_disable_lots_jobs.sh
Created May 5, 2021 00:54
Concourse Disable Lots of Jobs
fly login -t team -c https://my-concourse.com -u user -p password -n name
for pipeline in $(cat pipelines.txt)
do
fly -t team pause-job --job "team - ${pipeline}/dc - env2"
done
@ryanvgates
ryanvgates / find_unattached_volumes.sh
Last active May 5, 2021 00:39
OpenStack: Get unattached volumes
openstack volume list | grep -v -E "Attached to \w+"
@ryanvgates
ryanvgates / curl.sh
Created February 16, 2021 05:42
Fail TeamCity on not resolve host
set -x
set -e
ping -c 4 %host.name%
curl -H "Accept: application/json" -H \
http://%host.name%/GetStatus \
| jq . | tee status.txt
res=$?
@ryanvgates
ryanvgates / sensu-client.log
Last active March 23, 2022 20:46
Sensu Error Monitoring HAProxy
{
"timestamp": "2019-10-03T17:40:21.011942+0000",
"level": "info",
"message": "publishing check result",
"payload":
{
"client": "myclient",
"check":
{
"command": "/etc/sensu/plugins/check_haproxy.rb -S /tmp/haproxy.sock -A -W 70 -C 80",