{% for node in all_minions | sort %}
{# generate unique state IDs per target+loop iteration. #}
{%- macro gen_id(name) -%} {{ name }}_{{ node }}_{{ loop.index }} {%- endmacro -%}
{# XXX: an abort macro that logs to slack #}
{# XXX: a lock-checker that can also abort between steps #}
{%- macro gen_state(name) -%}
{{ name }}_{{ node }}_{{ loop.index }}:
salt.state:
- name: {{ name }}_{{ node }}_{{ loop.index }}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I feel like I should be able to see this with | |
# $ sudo salt-run state.event swi/autoscale/highstate | |
# But I'm not seeing anything. | |
def success_message(minion_name): | |
import salt.client | |
import json | |
__opts__ = salt.config.minion_config('/etc/salt/minion') | |
caller = salt.client.Caller(mopts=__opts__) | |
caller.cmd('event.send', 'swi/autoscale/highstate', json.dumps({"success": minion_name})) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import salt.cli.call | |
call = salt.cli.call.SaltCall() | |
call.parse_args(args=['state.highstate']) | |
# It's initialized but it's going to try to parse the command line, | |
# so override those properties | |
if call.options.master: | |
call.config['master'] = call.options.master | |
# Setup file logging! | |
call.setup_logfile_logger() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This seems like a bad idea, but it also seems to work | |
In [3]: baselist = range(20) | |
In [4]: baselist | |
Out[4]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] | |
In [5]: for item in baselist: | |
...: if item % 2: | |
...: baselist.append(item + 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package(default_visibility = ["//visibility:public"]) | |
load("@subpar//:subpar.bzl", "par_binary") | |
load( | |
"@io_bazel_rules_python//python:python.bzl", | |
"py_binary", "py_library", "py_test" | |
) | |
# Load the pip_install symbol for my_deps, and create the dependencies' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is in the orch state: | |
``` | |
{{ gen_id("artifact") }}: | |
salt.state: | |
- tgt: {{ node }} | |
- sls: | |
- deploy_{{ deploy.app_type }}.artifact | |
- pillar: | |
tier: {{ deploy['tier_name'] }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Putt his runner in your runners dir and you'll have the documented behavior back. | |
# | |
# -*- coding: utf-8 -*- | |
''' | |
Return cached data from minions | |
''' | |
from __future__ import absolute_import, print_function, unicode_literals | |
# Import python libs | |
import fnmatch | |
import logging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2018-07-02 15:24:28,851 [salt.utils.event ][DEBUG ] Sending event: tag = salt/run/20180702152428092436/new; data = {u'fun': u'runner.cache.grains', u'fun_args': [{u'tgt': u'dummy1'}], u'jid': u'20180702152428092436', u'user': u'sudo_ubuntu', u'_stamp': '2018-07-02T15:24:28.851086'} | |
2018-07-02 15:24:28,852 [salt.utils.reactor][DEBUG ] Gathering reactors for tag salt/run/20180702152428092436/new | |
2018-07-02 15:24:28,853 [salt.utils.master][DEBUG ] New instance of MasterPillarUtil created. | |
2018-07-02 15:24:28,853 [salt.utils.master][DEBUG ] Init settings: tgt: 'dummy1', tgt_type: 'glob', saltenv: 'None', use_cached_grains: True, use_cached_pillar: True, grains_fallback: False, pillar_fallback: True | |
2018-07-02 15:24:28,853 [salt.utils.master][DEBUG ] No minions matched for tgt="dummy1" and tgt_type="glob" | |
2018-07-02 15:24:28,854 [salt.utils.lazy ][DEBUG ] LazyLoaded local_cache.prep_jid | |
2018-07-02 15:24:28,855 [salt.loaded.int.returner.local_cache][DEBUG ] Adding minions for job 20180702152428092436 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import socket | |
import logging | |
import docopt | |
import appoptics_metrics | |
import java.io.BufferedReader; |
open st2kafka03.qa1:9999
domain java.lang
bean type=Memory
get HeapMemoryUsage
get NonHeapMemoryUsage