Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
nextgen-router
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
nextgen-router
Commits
fa0d3a97
Commit
fa0d3a97
authored
Feb 03, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use systemd to run initialize script
parent
0ce4cd5a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
16 deletions
+33
-16
files/interfaces.j2
files/interfaces.j2
+4
-0
files/utility.sh.j2
files/utility.sh.j2
+0
-16
network.yaml
network.yaml
+28
-0
variables.yaml
variables.yaml
+1
-0
No files found.
files/interfaces.j2
View file @
fa0d3a97
...
...
@@ -74,7 +74,11 @@ bridge_ports{% for link in br.links %} {% if br.macvlan is defined and br.macvla
{% else %}
bridge_ports none
{% endif %}
{% if br.stp is defined and br.stp %}
bridge_stp on
{% else %}
bridge_stp off
{% endif %}
bridge_maxwait 3
{% if br.type == "static" %}
address {{br.address}}
...
...
files/utility.sh.j2
100644 → 100755
View file @
fa0d3a97
...
...
@@ -12,7 +12,6 @@ restore_mark() {
}
ppp_origin() {
_nextgen_router_initialize
OPTION=$1
INTERFACE=$2
MARK=$[1000 + $(echo "$INTERFACE" | sed "s/ppp//g")]
...
...
@@ -21,22 +20,7 @@ ppp_origin() {
# ip6tables -t mangle "$OPTION" PREROUTING ! -p ospf -i "$INTERFACE" -j CONNMARK --set-xmark "$MARK"
}
_nextgen_router_initialize_process() {
{% for subnet in localnets %}
ip rule add pref 80 to {{subnet}} lookup main
{% endfor %}
ip rule add pref 80 to 172.16.0.0/12 lookup main
arp -f
}
_nextgen_router_initialize() {
ipset restore -f {{ansible_user_dir}}/nextgen-router/localnet-ipset && \
_nextgen_router_initialize_process
true
}
eth_origin() {
_nextgen_router_initialize
OPTION=$1
BRIDGE_NAME=$2
GATEWAY_ID=$3
...
...
network.yaml
View file @
fa0d3a97
...
...
@@ -33,6 +33,34 @@
name
:
/etc/ethers
state
:
touch
changed_when
:
false
-
name
:
initialize script
template
:
src
:
./files/initialize.sh.j2
dest
:
'
{{ansible_user_dir}}/nextgen-router/scripts/initialize.sh'
mode
:
0755
-
name
:
initialize systemd
become
:
true
copy
:
content
:
|
[Unit]
Description=MyCard NextGen Router Initialize
Before=network-online.target
After=network-pre.target
[Service]
Type=oneshot
ExecStart={{ansible_user_dir}}/nextgen-router/scripts/initialize.sh
[Install]
WantedBy=multi-user.target
dest
:
/etc/systemd/system/nextgen-router-initialize.service
register
:
initialize_systemd_result
-
name
:
initialize systemd enable
become
:
true
systemd
:
name
:
nextgen-router-initialize
enabled
:
true
daemon_reload
:
'
{{initialize_systemd_result.changed}}'
-
name
:
clean some rubbish packages
become
:
true
apt
:
...
...
variables.yaml
View file @
fa0d3a97
...
...
@@ -28,6 +28,7 @@ vars:
-
10.0.0.2/24
# 备选地址
gateways
:
null
# 网关,看下面
masq
:
false
# 是否MASQ
stp
:
false
# 是否开启STP,默认false
linkUp
:
echo 'link up'
# 链路启动脚本,用于奇怪的特殊链路或者netns
up
:
echo "up"
# 启动脚本和关闭脚本
down
:
echo "down"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment