nl2go.network_encryption
Ansible 角色:网络加密
一个管理基于 IPsec / strongSwan 的库存主机之间网络加密的 Ansible 角色。
要求
名称 | 类型 | 版本 | 位置 |
---|---|---|---|
ansible-filter | Python 包 | 1.0.0 | 控制节点 |
角色变量
可用的变量如下所示,包括默认值(请参见 defaults/main.yml
):
network_encryption_charon_port: 500
本地使用的 UDP 端口。如果设置为 0,将分配一个随机端口(参见 strongswan.conf)。
network_encryption_port_nat_t: 4500
在 NAT-T 情况下本地使用的 UDP 端口。如果设置为 0,将分配一个随机端口。必须与 charon.port 不同,否则将分配一个随机端口(参见 strongswan.conf)。
network_encryption_configs:
- name: default
psk: secret
配置集必须使用 network_encryption_configs
变量进行配置。配置集的 name
是必需的,用于标识。预共享密钥可以使用 psk
指定。
network_encryption_host_configs:
- name: default
可以使用 network_encryption_host_configs
变量将主机附加到配置集中。配置集通过 name
进行引用。
network_encryption_host_configs:
- name: default
state: absent
可以使用 state: absent
从配置集中分离主机。
network_encryption_configs:
- name: default
interface: eth0
psk: secret
可以使用 interface
变量指定接口。如果未指定,默认为 ansible_default_ipv4.interface
。
network_encryption_configs:
- name: default
psk: secret
params:
lifetime: 8h
一般连接参数如 lifetime
可以在 params
部分设置(参见 ipsec.conf 了解完整参数描述)。
network_encryption_default_config_params:
ike: aes256gcm16-prfsha384-modp4096,aes256gcm16-prfsha384-ecp384!
esp: aes256gcm16-modp4096,aes256gcm16-ecp384!
keyingtries: 0
ikelifetime: 1h
lifetime: 8h
dpddelay: 30
dpdtimeout: 120
dpdaction: clear
authby: secret
keyexchange: ikev2
type: tunnel
network_encryption_configs
中的 params
扩展/覆盖上述默认连接参数。
network_encryption_config_dir: "/etc/ipsec.d/{{ role_name }}"
定义自定义的 IPsec 配置目录以实现隔离目的。
标签
可以使用标签限制角色执行特定的任务模块。可用标签如下:
network_encryption
: 涵盖整个角色生命周期。network_encryption_install
,install
: 安装所需的包network_encryption_config
,config
: 配置所需的包
依赖
无。
示例剧本
- hosts: all
roles:
- nl2go.network_encryption
开发
使用 docker-molecule 按照说明运行 Molecule 或在本地安装 Molecule(不推荐,可能会出现版本冲突)。
使用以下命令运行测试:
molecule test --all
维护者
许可证
详见 LICENSE.md 文件。
作者信息
此角色由 Newsletter2Go GmbH 于 2019 年创建。
Manage network encryption between inventory hosts based on[IPsec](https://de.wikipedia.org/wiki/IPsec) /[strongSwan](https://www.strongswan.org/).
ansible-galaxy install nl2go.network_encryption