Commit 3ed649e1 authored by nanahira's avatar nanahira

put null connections away

parent 00e2129d
# force reload 6.14 # force reload 6.14
{% for connection in connections %} {% for connection in connections %}
{% if connection.protocol != "null" and not (connection.protocol == "oc" and connection.ocType == "server") and connection.remoteLocalAddress != address %} {% if not (connection.protocol == "oc" and connection.ocType == "server") and connection.remoteLocalAddress != address %}
{% if connection.inbound %} {% if connection.inbound %}
interface {{connection.name}} type tunnel rxcost {{connection.metric}} faraway true link-quality true interface {{connection.name}} type tunnel rxcost {{connection.metric}} faraway true link-quality true
{% else %} {% else %}
......
...@@ -19,7 +19,7 @@ local-port-readwrite 33123 ...@@ -19,7 +19,7 @@ local-port-readwrite 33123
#in deny #in deny
{% for connection in connections %} {% for connection in connections %}
{% if connection.protocol != "null" and not (connection.protocol == "oc" and connection.ocType == "server") and connection.remoteLocalAddress != address %} {% if not (connection.protocol == "oc" and connection.ocType == "server") and connection.remoteLocalAddress != address %}
{% if connection.inbound %} {% if connection.inbound %}
interface {{connection.name}} type tunnel rxcost {{connection.metric}} faraway true link-quality true interface {{connection.name}} type tunnel rxcost {{connection.metric}} faraway true link-quality true
{% else %} {% else %}
......
...@@ -27,7 +27,7 @@ protocol kernel { ...@@ -27,7 +27,7 @@ protocol kernel {
} }
{% for connection in connections %} {% for connection in connections %}
{% if connection.protocol != "null" and connection.remoteLocalAddress != address %} {% if connection.remoteLocalAddress != address %}
ipv4 table {{connection.name.replace("-", "_")}}; ipv4 table {{connection.name.replace("-", "_")}};
protocol static { protocol static {
ipv4 { ipv4 {
...@@ -82,7 +82,7 @@ protocol ospf v2 { ...@@ -82,7 +82,7 @@ protocol ospf v2 {
# hello 5; # Default hello perid 10 is too long # hello 5; # Default hello perid 10 is too long
# }; # };
{% for connection in connections %} {% for connection in connections %}
{% if connection.protocol != "null" and connection.remoteLocalAddress != address %} {% if connection.remoteLocalAddress != address %}
interface "{{connection.name}}" { interface "{{connection.name}}" {
type ptp; type ptp;
{% if connection.outbound %} {% if connection.outbound %}
......
...@@ -99,14 +99,14 @@ ...@@ -99,14 +99,14 @@
include_tasks: 'protocols/{{item.protocol}}/configure.yaml' include_tasks: 'protocols/{{item.protocol}}/configure.yaml'
vars: vars:
conn: '{{item}}' conn: '{{item}}'
loop: '{{ connections }}' loop: '{{ nullConnections }}'
when: "not noUpdateLinks and item.protocol is defined and item.protocol == 'null' and not item.noUpdate" when: "not noUpdateLinks and item.protocol is defined and not item.noUpdate"
- name: 'loop through list from a variable' - name: 'loop through list from a variable'
include_tasks: 'protocols/{{item.protocol}}/configure.yaml' include_tasks: 'protocols/{{item.protocol}}/configure.yaml'
vars: vars:
conn: '{{item}}' conn: '{{item}}'
loop: '{{ connections }}' loop: '{{ connections }}'
when: "not noUpdateLinks and item.protocol is defined and item.protocol != 'null' and not item.noUpdate" when: "not noUpdateLinks and item.protocol is defined and not item.noUpdate"
# end # end
- name: services conf - name: services conf
copy: copy:
......
...@@ -288,6 +288,7 @@ class InventoryBuilder { ...@@ -288,6 +288,7 @@ class InventoryBuilder {
async host_vars(host: CommonEntry) { async host_vars(host: CommonEntry) {
const connections = []; const connections = [];
const nullConnections = [];
host.dockerServices = { host.dockerServices = {
version: '2.4', version: '2.4',
services: { services: {
...@@ -388,11 +389,11 @@ class InventoryBuilder { ...@@ -388,11 +389,11 @@ class InventoryBuilder {
// 对称连接 // 对称连接
const connectionString = from || to; const connectionString = from || to;
connections.push(await this.parse_connection(host, this.hosts[h], connectionString, true, true, connectionString === from)); connections.push(await this.parse_connection(host, this.hosts[h], connectionString, true, true, connectionString === from));
connections.push(await this.parse_connection(host, this.hosts[h], null_connection, false, false, false)); nullConnections.push(await this.parse_connection(host, this.hosts[h], null_connection, false, false, false));
} else { } else {
// 不连接 // 不连接
connections.push(await this.parse_connection(host, this.hosts[h], null_connection, true, false, false)); nullConnections.push(await this.parse_connection(host, this.hosts[h], null_connection, true, false, false));
connections.push(await this.parse_connection(host, this.hosts[h], null_connection, false, true, false)); nullConnections.push(await this.parse_connection(host, this.hosts[h], null_connection, false, true, false));
} }
const targetHost = this.hosts[h]; const targetHost = this.hosts[h];
routePlans.push({ routePlans.push({
...@@ -424,6 +425,7 @@ class InventoryBuilder { ...@@ -424,6 +425,7 @@ class InventoryBuilder {
ocpasswdLines: host.ocpasswdLines || [], ocpasswdLines: host.ocpasswdLines || [],
gateways: _.values(this.gateways[host.name]), gateways: _.values(this.gateways[host.name]),
connections, connections,
nullConnections,
lanInterfaces, lanInterfaces,
localSubnets, localSubnets,
masqInterfaces, masqInterfaces,
......
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