ユーザ用ツール

サイト用ツール


serverapps:configmgmt:fabric

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
serverapps:configmgmt:fabric [2017/08/16 05:31] – [mini Tips] hayashiserverapps:configmgmt:fabric [2023/07/26 11:03] (現在) – [このページについて] hayashi
行 1: 行 1:
 +====== fabric ======
 +===== このページについて =====
 +fabricインストールメモ。
  
 +メイン環境のFreeBSDへの対応が甘々でブチ切れたのでインストールまででおしまい((bash依存してやんのorz))
 +===== Install =====
 +
 +  # pip install fabric
 +
 +pipのinstallは[[development:language:python:pip|こちら]]を参照
 +
 +===== cusine =====
 +
 +fabricに冪等性を授けるライブラリ
 +
 +  # pip install cusine
 +
 +===== envassert =====
 +
 +fabricで動作する環境テストツール
 +
 +  # pip install envassert
 +==== mini Tips ====
 +
 +=== shellの指定 ===
 +
 +%%[-s|--sell]%%オプションを使う((defaultは"/bin/bash -l -c"))
 +
 +  # fab --host user@localhost -s '/bin/sh -c' -- uname -s
 +
 +または、fabfile.pyで指定
 +
 +<file python fabfile.py>
 +env.shell = '/bin/sh -i -c'
 +env.hosts = ['localhost']
 +env.user = 'usernamae'
 +</file>
 +
 +関数で設定するのもOK
 +
 +<code python>
 +def exists(path):
 +    with settings(warn_only=True):
 +        return run('test -e %s' % path)
 +</code>
 +===== 参考 =====
 +
 +[[https://www.slideshare.net/greenasparagus/ss-42424543|意識の低い自動化]]
 +
 +[[http://fabric-ja.readthedocs.io/ja/latest/usage/env.html|環境辞書、 env]]
serverapps/configmgmt/fabric.txt · 最終更新: 2023/07/26 11:03 by hayashi