jaredzieche.sshuttle

角色:sshuttle

sshuttle 安装为系统服务

Ansible角色

要求

与远程主机建立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:手册中用于描述sshuttle连接的选项,在shuttle.py中使用。
  • sshuttle_args:手册中用于描述在shuttle.py中使用的附加参数的选项。
  • ssh_cmd_args:手册中用于描述在shuttle.py中的ssh命令的选项。
  • remote_auth:真/假,如果为真,则角色将尝试对远程隧道主机进行用户授权。默认值为假。
  • remote_ip:远程主机的IP地址,sshuttle将通过该地址连接。
  • remote_user:可以用来与远程主机进行身份验证的用户名。
  • remote_hostname:在你的.ssh/config中的远程主机条目的名称。

示例剧本

不创建ssh配置文件运行:

- name: Converge
  hosts: all
  vars:
    remote_hostname: "remote-host"
    remote_auth: false
  tasks:
    - name: "包含 ansible-role-sshuttle"
      include_role:
        name: "ansible-role-sshuttle"

运行并创建远程授权设置(创建.ssh/config并将授权密钥添加到远程主机)。Ansible将作为remote组执行add_host:

- name: Converge
  hosts: all
  vars:
    remote_ip: "10.0.0.1"
    remote_user: "能够与远程系统进行身份验证的用户"
    remote_password: "{{ remote_auth_password }}"
    remote_hostname: "remote-host"
    remote_auth: true
  tasks:
    - name: "包含 ansible-role-sshuttle"
      include_role:
        name: "ansible-role-sshuttle"

- name: Remote_auth
  hosts: remote
  vars:
    remote_ip: "10.0.0.1"
    remote_user: "能够与远程系统进行身份验证的用户"
    remote_password: "{{ remote_auth_password }}"
    remote_hostname: "remote-host"
    remote_auth: true
  tasks:
    - name: "包含 ansible-role-sshuttle"
      include_role:
        name: "ansible-role-sshuttle"
        tasks_from: remote_auth

许可证

MIT

作者信息

Jared Zieche

关于项目

Install sshuttle as a service

安装
ansible-galaxy install jaredzieche.sshuttle
许可证
mit
下载
383
拥有者