Skip to content

Instantly share code, notes, and snippets.

@gtmanfred
gtmanfred / checkdns
Last active April 10, 2018 15:54
save ip of server to DO api if dhcp changes it for some reason
#!/usr/bin/env python3
import aiocron
import aiohttp
import asyncio
import fcntl
import json
import logging
import os
import socket
import struct
[root@salt ~]# tail -c +0 /srv/{pillar,salt}/*
==> /srv/pillar/test.sls <==
nopass_sections:
bamboodeploy:
- '/usr/sbin/service railscheduler restart'
- '/bin/systemctl restart lstemailq.service'
==> /srv/pillar/top.sls <==
base:
'*':
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
* Starting salt-master ... 21:34:23,796 [tests.support.processes:130 ][INFO ] [salt-master] Starting pytest salt-master/master(master)
21:34:23,797 [pytestsalt.utils:412 ][INFO ] [salt-master/master][SaltMaster(master)] Starting DAEMON in CWD: /testing
21:34:23,797 [tests.support.paths:109 ][INFO ] Generating /tmp/salt-tests-tmpdir/scripts/cli_master.py
21:34:23,798 [tests.support.paths:136 ][INFO ] Returning script path '/tmp/salt-tests-tmpdir/scripts/cli_master.py'
21:34:23,801 [pytestsalt.utils:421 ][INFO ] [salt-master/master][SaltMaster(master)] Running '/tmp/salt-tests-tmpdir/scripts/cli_master.py -c /tmp/salt-tests-tmpdir/config -l quiet'...
21:34:23,804 [salt.utils.nb_popen :96 ][INFO ] Running command under pid 9615: '(['/tmp/salt-tests-tmpdir/scripts/cli_master.py', '-c', '/tmp/salt-tests-tmpdir/config', '-l', 'quiet'],)'
21:34:23,827 [tests.support.paths :109 ][INFO ] Generating /tmp/salt-tests-tmpdir/scripts/cli_run.py
21:34:23,828 [tests.suppor
@gtmanfred
gtmanfred / -
Created October 23, 2017 17:14
#!/usr/bin/env bash
# stop on errors
set -eu
if [[ $PACKER_BUILDER_TYPE == "qemu" ]]; then
DISK='/dev/vda'
else
DISK='/dev/sda'
fi
[DEBUG ] GET call to compute for http://10.128.0.2/compute/v2.1/servers/d552705e-aa32-4b18-9ebc-c9fc8bfbbe78/os-security-groups used request id req-bf1dc9a7-9995-412f-8322-75a8bd40f65c
[DEBUG ] Manager democloud:RegionOne ran task compute.GET.servers.os-security-groups in 0.460741996765s
[DEBUG ] GET call to compute for http://10.128.0.2/compute/v2.1/servers/d552705e-aa32-4b18-9ebc-c9fc8bfbbe78/os-security-groups used request id req-bf1dc9a7-9995-412f-8322-75a8bd40f65c
[DEBUG ] Manager democloud:RegionOne running task compute.GET.servers.os-security-groups
[DEBUG ] REQ: curl -g -i -X GET http://10.128.0.2/compute/v2.1/servers/8b035fd2-78ed-408f-b226-2bc7a8c874d9/os-security-groups -H "User-Agent: os-client-config/1.28.0 shade/1.25.0 keystoneauth1/3.3.0 python-requests/2.6.0 CPython/2.7.5 Linux/3.10.0-693.5.2.el7.x86_64 CPython/2.7.5" -H "X-Auth-Token: {SHA1}97f0130c9964bac5e0894a29b93d4ee2e9805a25"
^C^C^C[DEBUG ] RESP: [200] content-length: 1126 x-compute-request-id: req-274f3960-b5ac-4eff-a8bd-f6
2018-02-06 15:19:01,051 [salt.transport.mixins.auth][TRACE ][10731] Decoding payload: {'load': '\x85F\x03C\x83\xd0*!\xe5\x8d\xa9Xl\xe1\x99\x15<\x1e\x0ft2A\x03$m\x8a\x7f\xd4\xfdf\xcb\x0c9\x03\x15# #\xd8R\xe2\xf2\xb8\xc4\xa5\x90>\xd7"\xdf\xfa\xa03\xbc\x8dl\xe2\x12:\xcb\xbd\xd6\xe5\x04\xaeb\xce\x1b \xaeI|\x8dIS\x07\xd82\xd5\x99\xae\x99;\x98\x88:t\xba\xa1G\xaa*\xbb\x8cL\xe8\x18g\x9d\xf6\x81\xcd\xe1\x8d\x07\xe8\xb9%<\xb0:0\xb0\xe2\x03x\x9fDb\x11\xa2\xc0\xec\xdc\xfd\x8e\xa9\x0c\xb2\xa9S\xfb\xcau\xa6\xb0\xbf\x9eQ|L\t\x06\x89', 'enc': 'aes', 'sig': '\xa4\xa4[\x9a\xa9\xa2~\x12\xb3\x95[\xfa/\x88!\xc5K\xdf,a\xd5\x84F\xef\x8d\xdc\x13L\x86Z\x15f}\xdcq\x0f\xc6\xde\xc8)\xd9FU>\x19\xd6o3\xd0\xea\x18\xdf\xa6&\x02!i\x18\xe2\xa77\xf1\x0f\x14\x0cBRx\x1d\xc5Z\xd3\xff4\x8ahAL\xc9\xac\x98UU\xd4U\x1eQ}\x1d\x93\xb5u\xd7\xc2ofq\xbb\x19\x8f*\xdd\x13"h\xee\xf5\x05f\xb4\xb5\xc4\x18AH\xe8\xf9`d@E\xb1\xa9a\xdf\x7f\xe0\x807\xd6\xdb{XY\x82\x02\xf2\xe5\xfa\x84NYaL@\xc7X\x1a\xd5\xdcN\x06u+\x93\xa7\xeb\xdc\xe2\x93I\xa5\xe06?\t\x8a\xc0\x8b(_\
root@salt:/srv/salt# salt \* state.apply wk
salt:
----------
ID: wkhtmltopdf-pkgs
Function: pkg.installed
Name: libxrender1
Result: True
Comment: The following packages were installed/updated: libxrender1
Started: 18:04:23.925537
Duration: 6256.939 ms
import irc3
import json
import re
@irc3.plugin
class Slack:
def __init__(self, bot):
self.web = irc3.utils.maybedotted('aiohttp')
[bot]
nick = <nick>
host = chat.freenode.net
port = 6697
ssl = true
sasl_username = <username>
sasl_password = <password>
includes =
irc3.plugins.slack
autojoins =