LoginSignup
3
4

More than 5 years have passed since last update.

SaltStackを始めて困ったことまとめ

Last updated at Posted at 2016-07-04

チュートリアルあるの?

Salt in 60 seconds
公式チュートリアル
Manage the cloud with Terraform, Salt, Consul and DigitalOcean
Salt Notes

Ansible、Puppet、Chefなどとどう違うの

Amon - SaltStack - Review and how it fares against Ansible and Puppet?

python 2なの?3なの?

2です。

そのうち3になるかも。

参考: Python 2.7.x と 3.x の決定的な違いを例とともに | プログラミング | POSTD

pythonって*env的なのあるの?

pyenvがある。

参考: http://qiita.com/nyango/items/f227c259485fbd3c7c9c

saltモジュールのpythonソースにjavadocみたいな型指定のコメントかかれてるけど・・・

PyCharmのtype hintingらしい?

参考: http://qiita.com/methane/items/e95c578c3d8fc5f1f62e

test-kitchen使えないの?

kitchen-saltで使える
Test Kitchen style testing for Salt

saltのテストはPythonつながりでtestinfraでやる、って人もいるかもしれません。
そういう人はbusser-testinfraを使いましょう

https://github.com/jcftang-r7/busser-testinfra
https://github.com/test-kitchen/busser/issues/28

pythonわからん

以下の様なパターンさえ覚えておけば、あとはpythonで困ることは無い気がする。(salt自体の改造とかしなければ)

# Simulating a 'local static' variable in python
# http://stackoverflow.com/a/460811
class Bar(object):
    def __init__(self):
        self._cache = {}
    def __call__(self, a):
        if a not in self._cache:
            self._cache[a] = self.evaluate(a)
        return self._cache[a]
    def evaluate(self, a):
        return 'foo'

_bar = Bar()

def bar():
    return _bar(1)

class propertycache(object):
    def __init__(self, func):
        self.func = func
        self.name = func.__name__
    def __get__(self, obj, type=None):
        result = self.func(obj)
        self.cachevalue(obj, result)
        return result
    def cachevalue(self, obj, value):
        setattr(obj, self.name, value)

# $ salt-run myrunner.baz
# 'myrunner.baz' is not available.
@propertycache
def baz():
    return 'baz'

SSH経由で実行できる?

salt-ssh

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4