0x0i.tmux

ansible ロゴ

tmux ロゴ

Ansible ロール :eyeglasses: tmux

Galaxy Role GitHub リリース(最新日付) ライセンス: MIT

目次

この Ansible ロールは、tmux をインストール、設定、実行するためのもので、複数のターミナルを作成、アクセス、制御できる端末マルチプレクサです。

サポートされているプラットフォーム:
* Debian
* Redhat (CentOS/Fedora)
* Ubuntu

要件

libevent 2.x および ncurses ソフトウェアパッケージの事前インストールが必要です。

ロール変数

変数は、次のソフトウェアとマシンプロビジョニングの段階に従って整理されています。

  • install
  • config
  • uninstall

インストール

tmuxは、サポートされているプラットフォームで提供されるOSパッケージ管理システム(例:aptyum/dnf)を使用してインストールできます。

このインストールプロセスのさまざまな側面を制御するためにカスタマイズできる変数は次のとおりです:

service_package: <パッケージ名とバージョン>デフォルトtmux[-latest])

  • ダウンロードおよびインストールするtmuxパッケージの名前とバージョン。参考 または、端末で dnf --showduplicates list tmux のようなコマンドを実行して利用可能なパッケージのリストを表示します。

設定

このロールを使用すると、tmuxインスタンスの設定は tmux_configユーザー変数で管理され、ユーザーアカウントによってキーが付けられたハッシュで表現できます。これらのユーザーアカウントキーの値は、関連付けられたスタートアップ/設定コマンドとコマンドシーケンス(実行によってリンクされたコマンドの組み合わせ)、および optional コメントを表す辞書や辞書のリスト、もしくはその組み合わせです。

以下は、参照用の概要および例示的な設定です:

[tmux_config: {global | user-account} : {entry} :] comment: <文字列>デフォルトなし

  • 設定コマンドまたはコマンドシーケンスに関連する[オプション]のコメント
 tmux_config:
   global:
     - comment: "このコメントは、以下のコマンドの文脈を提供します"
       commands:
         - "source-file": "'~/.tmux.conf'"

[tmux_config: {global | user-account} : {entry} :] commands: <キー: 値,...>デフォルトdefaults/main.ymlを参照)

  • user-accountのtmux.conf内にレンダリングするための設定コマンドのコレクション。利用可能なコマンドのリストはこちらで見つけることができます。

通常、各キー:値のペアはそれぞれ、tmuxコマンドの {command}: {flags} コンポーネントを表します:

 tmux_config:
   global:
     - comment: "ctrl-A を2番目のプレフィックスキーとして追加"
       commands:
         # {command}: {flags} 形式
         - "set-option": "-g prefix2 C-a"
         - "bind-key": "C-a send-prefix -2"

ただし、技術的には、tmuxコマンド構文の任意の分割が許可されており、望ましい設定が正しくレンダリングされるべきです。

 tmux_config:
   user-account-1:
     - commands:
         - "bind-key C-c": "new-session"
         - "if-shell true": "{ display -p 'bar-dollar-foo: $foo' }"
         - "set-hook -g pane-mode-changed[42] 'set -g status-left-style bg=red'": ""
     - commands:
         - "set": "-g @plugin 'tmux-plugins/tpm'"
           "set -g": "@plugin 'tmux-plugins/tmux-sensible'"
       comment: "tmux TPMおよび'tmux-sensible'(合理的な設定)プラグインをインストール"

アンインストール

パッケージのインストールと管理されたtmuxユーザー構成の両方を削除し、このロールが適用される前の設定状態にターゲットホストを戻します(例:システムのアップグレード中に設定を再利用するのに便利です)。

このアンインストールプロセスを管理するためにカスタマイズできる変数は次のとおりです:

perform_uninstall: <true | false>デフォルトfalse

  • ターゲットホスト上で管理されたtmuxインストールとユーザー構成をアンインストールするかどうか(詳細handlers/main.ymlを参照)

依存関係

なし

例示プレイブック

デフォルトの例:

- hosts: all
  roles:
  - role: 0x0I.tmux

特定のバージョンをインストールおよび管理します:

- hosts: all
  roles:
  - role: 0x0I.tmux
    vars:
      service_package: tmux-2.7-2

Tmux "sensible (設定)" プラグインの設定を手動で適用します:

- hosts: all
  roles:
  - role: 0x0I.tmux
    vars:
      tmux_config:
        global:
          - comment: "utf8をオンにします"
            commands:
              - "set-option": "-g utf8 on"
              - "set-option": "-g status-utf8 on"
          - comment: "vimモード切替の遅延を解消します (http://superuser.com/a/252717/65504)"
            commands:
              - "set-option": "-s escape-time 0"
          - comment: "スクロールバックバッファサイズを増やします"
            commands:
              - "set-option": "-g history-limit 50000"
          - comment: "tmuxメッセージは4秒間表示されます"
            commands:
              - "set-option": "-g display-time 4000"
          - comment: "'status-left'および'status-right'をより頻繁にリフレッシュ"
            commands:
              - "set-option": "-g status-interval 5"
          - comment: "$TERMをアップグレード"
            commands:
              - "set-option": "-g default-terminal 'screen-256color'"
          - comment: "tmuxコマンドプロンプト(プレフィックス + :)でemacsキーのバインディングがvimユーザーにも優れています"
            commands:
              - "set-option": "status-keys emacs"
          - comment: "フォーカスイベントをサポートする端末で有効にします"
            commands:
              - "set-option": "-g focus-events on"
          - comment: "グループセッションとマルチモニターセットアップで非常に便利です"
            commands:
              - "set-window-option": "-g aggressive-resize on"
          - comment: "次/前のウィンドウ間の切替を簡単かつ迅速にします"
            commands:
              - "bind-key": "C-p previous-window"
              - "bind-key": "C-n next-window"
          - comment: ".tmux.confを、`man tmux`で推奨されたようにソースします"
            commands:
              - "bind-key": "R source-file '~/.tmux.conf'"
          - comment: "プレフィックスが 'C-a' の場合"
            commands:
              - "bind-key": "C-a send-prefix"
              - "bind-key": "a last-window"

...またはプラグインインストールを含む:

- hosts: all
  roles:
  - role: 0x0I.tmux
    vars:
      tmux_config:
        global:
          - comment: "sensibleをTPMプラグインのリストに追加"
            commands:
              - "set-option": "-g @plugin 'tmux-plugins/tmux-sensible'"

ライセンス

MIT

著者情報

このロールは2019年にO1.IOによって作成されました。

プロジェクトについて

tmux, a terminal multiplexer enabling multiple terminals to be created, accessed, and controlled from a single screen

インストール
ansible-galaxy install 0x0i.tmux
ライセンス
Unknown
ダウンロード
299
所有者