jaredzieche.sshuttle
役割: sshuttle
sshuttleをシステムサービスとしてインストールします。
要件
トンネルを確立するためのリモートホストへのSSH接続 Linuxホスト
役割変数
- sshuttle_user: サービスが実行されるユーザー
- sshuttle_group: サービスが実行されるグループ
- sshuttle_package: インストールするsshuttleパッケージの名前
- sshuttle_hosts: リモートサーバーとその解決されたサブネットの辞書。これはサービス設定ファイル用にJSONに変換されます。
sshuttle_hosts: "{{ remote_hostname }}": - 10.0.0.0/24 - 172.16.0.0/24 - 192.168.0.0/24
- sshuttle_options: manpageから取得したオプションで、shuttle.py内のsshuttle接続を説明します。
- sshuttle_args: manpageから取得したオプションで、shuttle.py内の追加引数を説明します。
- ssh_cmd_args: manpageから取得したオプションで、shuttle.py内のsshコマンドを説明します。
- remote_auth: true/false。trueの場合、役割はリモートトンネルホストへのユーザー認証を試みます。デフォルトはfalseです。
- remote_ip: sshuttleが接続するリモートホストのIPアドレス。
- remote_user: リモートホストで認証に使用できるユーザー名。
- remote_hostname: .ssh/config内のリモートホストのエントリ名。
例プレイブック
ssh設定ファイルを作成せずに実行します:
- 名前: Converge
ホスト: all
変数:
remote_hostname: "remote-host"
remote_auth: false
タスク:
- 名前: "ansible-role-sshuttleを含む"
include_role:
name: "ansible-role-sshuttle"
リモート認証設定を作成して実行します(.ssh/configを作成し、リモートホストに認証済みキーを追加します)。Ansibleはremote
グループとしてadd_hostを実行します:
- 名前: Converge
ホスト: all
変数:
remote_ip: "10.0.0.1"
remote_user: "リモートシステムで認証できるユーザー"
remote_password: "{{ remote_auth_password }}"
remote_hostname: "remote-host"
remote_auth: true
タスク:
- 名前: "ansible-role-sshuttleを含む"
include_role:
name: "ansible-role-sshuttle"
- 名前: Remote_auth
ホスト: remote
変数:
remote_ip: "10.0.0.1"
remote_user: "リモートシステムで認証できるユーザー"
remote_password: "{{ remote_auth_password }}"
remote_hostname: "remote-host"
remote_auth: true
タスク:
- 名前: "ansible-role-sshuttleを含む"
include_role:
name: "ansible-role-sshuttle"
tasks_from: remote_auth
ライセンス
MIT