Skip to content

Instantly share code, notes, and snippets.

@viq
viq / pillars_mine.sls
Created August 5, 2020 19:22
Some examples of using salt mine and publish.publish
mine_functions:
external_ip:
- mine_function: grains.get
- key: external_ip
ssh.host_keys:
- keydir: /etc/ssh
- private: False
ssh_backup_key:
- mine_function: ssh.user_keys
- user: root
@viq
viq / defaults.yaml
Last active August 12, 2020 12:44
Serialization doesn't seem to maintain the structure
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
borg:
backup_key: '/root/.ssh/backup_key'
borgmatic:
location:
source_directories:
- /etc
- /home
@viq
viq / bg_monitoring.json
Created November 15, 2019 11:44
Grafana dashboard for monitoring xdrip data
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@viq
viq / gen-telegraf
Last active August 4, 2019 23:31
Generate telegraf config for multiple nightscout servers
#!/bin/bash
cat << END
[agent]
omit_hostname = true
[[outputs.file]]
files = ["stdout"]
data_format = "influx"
@viq
viq / telegraf-nightscout.conf
Last active May 10, 2019 21:59
Telegraf config for querying nightscout
[global_tags]
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
@viq
viq / get_profile.py
Last active June 1, 2019 21:22
Script for getting nightscout profile data
#!/usr/bin/env python
"""
Module to ease work with nightscout profiles.
By default lists all profiles found, and supports following sub-commands:
* profiles - list defined profiles
* display - display named (or default) profile
(in nightscout or OpenAPS format)
* get - save to disk profile in OpenAPS format
"""
@viq
viq / nightscout.sls
Created September 22, 2018 00:39
WIP state to set up nightscout
include:
- mongodb
setup nightscout:
pkg:
- installed
- names:
- git
- node
- supervisor
@viq
viq / init.sls
Last active September 14, 2018 19:52
First attempt at automating installing mongodb and configuring it to require authentication
prepare mongodb:
pkg:
- installed
- pkgs:
- mongodb
- py-mongo
file:
- managed
- name: /etc/mongodb.conf
- source: salt://mongodb/mongodb.conf
@viq
viq / netdevs.py
Created December 30, 2017 23:29
saltstack custom grain displaying separately physical and virtual network interfaces
# -*- coding: utf-8 -*-
'''
Display virtual and physical network devices separately
'''
from __future__ import absolute_import
# Import python libs
import os
import logging
from os.path import join
@viq
viq / .kitchen.yml
Last active July 15, 2016 09:10
test-kitchen with lxc, cfengine and serverspec
---
driver:
name: vagrant
vagrantfile_erb: Vagrantfile.erb
#provision: true
#http_proxy: http://10.0.2.2:8123
#https_proxy: https://10.0.2.2:8123
provisioner:
name: cfengine