nl2go.vpn_gateway
Ansible Role: VPN ゲートウェイ
この Ansible ロールは、2つのピア間での VPN トンネルの設定を IPsec / strongSwan に基づいて管理し、ゲートウェイに関連するルーティング設定を提供します。
ロール変数
使用可能な変数は以下にリストされています。デフォルト値も含まれています(defaults/main.yml
を参照):
vpn_gateway_configs:
- name: default
psk: secret
構成セットは vpn_gateway_configs
という変数を使って定義する必要があります。構成セットの name
は必須で、識別に使用されます。プレシェアードキーは psk
で指定できます。
vpn_gateway_configs:
- name: default
state: absent
特定のゲートウェイ設定は state: absent
を使って削除できます。
vpn_gateway_configs:
- name: default
psk: secret
params:
lifetime: 8h
一般的な接続パラメータ(例: lifetime
)は params
セクション内に設定できます(詳細なパラメータ説明については ipsec.conf を参照)。
vpn_gateway_configs:
- name: default
psk: secret
local:
public: 1.1.1.1
networks:
- 172.4.0.0/21
remote:
public: 1.2.3.4
networks:
- 172.240.0.0/21
- 10.2.0.0/16
構成セットには local
と remote
ピア構成の部分が含まれます。
vpn_gateway_default_config_params:
type: tunnel
keyingtries: 0
ikelifetime: 1h
lifetime: 8h
dpddelay: 300s
dpdtimeout: 120
dpdaction: clear
authby: secret
auto: start
esp: aes256-sha256-modp3072
ike: aes256-sha256-modp3072
keyexchange: ikev2
leftfirewall: 'yes'
compress: 'no'
rekey: 'no'
fragmentation: 'yes'
forceencaps: 'yes'
vpn_gateway_configs
内の params
は、上記のデフォルト接続パラメータを拡張または上書きします。
vpn_gateway_config_dir: "/etc/ipsec.d/{{ role_name }}"
カスタム IPsec 構成ディレクトリを定義し、分離の目的で使用します。
タグ
タグを使用して、ロール実行を特定のタスクモジュールに制限できます。以下のタグが利用可能です:
vpn_gateway
: フルロールライフサイクルをカバー。vpn_gateway_validate
,validate
: 指定された構成を検証。vpn_gateway_install
,install
: 必要なパッケージをインストール。vpn_gateway_config
,config
: 必要なパッケージを構成。
依存関係
なし。
例のプレイブック
- hosts: all
roles:
- nl2go.vpn_gateway
開発
docker-molecule を使用し、Molecule を実行する手順に従うか、Molecule をローカルにインストールします(推奨しません。バージョンの競合が発生する可能性があります)。
Hetzner Cloudトークンを提供:
export HCLOUD_TOKEN=123abc456efg
テストを実行するには次を使用します:
molecule test --all
メンテイナー
ライセンス
詳細については LICENSE.md ファイルを参照してください。
作者情報
このロールは 2020 年に Newsletter2Go GmbH によって作成されました。
Manages a VPN tunnel setup between two peers based on IPsec/strongSwanand provides gateway related routing configuration.
ansible-galaxy install nl2go.vpn_gateway