Commit c7673594 authored by 神楽坂玲奈's avatar 神楽坂玲奈

bird

parent 81e3c26f
...@@ -12,26 +12,28 @@ ...@@ -12,26 +12,28 @@
src: scripts/predown.sh src: scripts/predown.sh
dest: '/etc/wireguard/predown.sh' dest: '/etc/wireguard/predown.sh'
mode: a+x mode: a+x
# 为了提高测试时候的性能,不改动wg的时候注释掉这段
- name: 'loop through list from a variable' - name: 'loop through list from a variable'
include_tasks: 'protocols/{{item.protocol}}/{{item.protocol}}.yaml' include_tasks: 'protocols/{{item.protocol}}/{{item.protocol}}.yaml'
vars: vars:
conn: '{{item}}' conn: '{{item}}'
with_items: '{{ connections }}' with_items: '{{ connections }}'
- name: 安装软件包 (apt)
apt: # - name: 安装软件包 (apt)
name: bird2 # apt:
state: latest # name: bird2
when: ansible_os_family == "Debian" # state: latest
# when: ansible_os_family == "Debian"
# - name: 安装软件包 (yum)
# yum:
# name: bird2
# state: latest
# when: ansible_os_family == "RedHat"
- name: 鸟配置 (apt) - name: 鸟配置 (apt)
template: template:
src: bird.conf.j2 src: bird.conf.j2
dest: '/etc/bird/bird.conf' dest: '/etc/bird/bird.conf'
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- name: 安装软件包 (yum)
yum:
name: bird2
state: latest
when: ansible_os_family == "RedHat"
- name: 鸟配置 (yum) - name: 鸟配置 (yum)
template: template:
src: bird.conf.j2 src: bird.conf.j2
......
...@@ -77,8 +77,8 @@ class InventoryBuilder { ...@@ -77,8 +77,8 @@ class InventoryBuilder {
const localPort = primary ? remote.port : remote.port2; const localPort = primary ? remote.port : remote.port2;
const remotePort = primary ? local.port : local.port2; const remotePort = primary ? local.port : local.port2;
const wgPublicKey = remote.wgPublickey; const wgPublicKey = remote.wgPublickey;
const localPeerAddress = primary ? local.peerAddress : local.peerAddress2; const localPeerAddress = primary ? `10.200.${local.id}.${remote.id}` : `10.201.${local.id}.${remote.id}`;
const remotePeerAddress = primary ? remote.peerAddress : remote.peerAddress2; const remotePeerAddress = primary ? `10.200.${remote.id}.${local.id}` : `10.201.${remote.id}.${local.id}`;
return { return {
name, name,
metric, metric,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment