Commit 6ded7cc6 authored by nanahira's avatar nanahira

async and migrate image

parent 5999d343
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
name: '{{item}}' name: '{{item}}'
source: pull source: pull
with_items: with_items:
- git-registry.mycard.moe/nanahira/docker-smartdns - git-registry.moenext.com/nanahira/docker-smartdns
- git-registry.mycard.moe/nanahira/dnsmasq:original - git-registry.moenext.com/nanahira/dnsmasq:original
- name: clean some rubbish packages - name: clean some rubbish packages
become: true become: true
apt: apt:
......
...@@ -76,7 +76,9 @@ handle_gateway() { ...@@ -76,7 +76,9 @@ handle_gateway() {
ip rule add pref 100 fwmark "$GATEWAY_NEXT_HOP_MARK" lookup "$GATEWAY_NEXT_HOP_MARK" ip rule add pref 100 fwmark "$GATEWAY_NEXT_HOP_MARK" lookup "$GATEWAY_NEXT_HOP_MARK"
ip rule add pref 400 fwmark "$GATEWAY_SELECTION_MARK" lookup "$GATEWAY_NEXT_HOP_MARK" ip rule add pref 400 fwmark "$GATEWAY_SELECTION_MARK" lookup "$GATEWAY_NEXT_HOP_MARK"
{% if not br.noOrigin | default(false) %}
eth_origin -I "$BRIDGE_NAME" "$GATEWAY_ID" "$GATEWAY_ADDRESS" "$GATEWAY_MAC" eth_origin -I "$BRIDGE_NAME" "$GATEWAY_ID" "$GATEWAY_ADDRESS" "$GATEWAY_MAC"
{% endif %}
} }
{% if br.gateways is defined and br.gateways %} {% if br.gateways is defined and br.gateways %}
......
...@@ -25,7 +25,9 @@ handle_gateway() { ...@@ -25,7 +25,9 @@ handle_gateway() {
ip rule del pref 100 fwmark "$GATEWAY_NEXT_HOP_MARK" lookup "$GATEWAY_NEXT_HOP_MARK" ip rule del pref 100 fwmark "$GATEWAY_NEXT_HOP_MARK" lookup "$GATEWAY_NEXT_HOP_MARK"
ip rule del pref 400 fwmark "$GATEWAY_SELECTION_MARK" lookup "$GATEWAY_NEXT_HOP_MARK" ip rule del pref 400 fwmark "$GATEWAY_SELECTION_MARK" lookup "$GATEWAY_NEXT_HOP_MARK"
{% if not br.noOrigin | default(false) %}
eth_origin -D "$BRIDGE_NAME" "$GATEWAY_ID" "$GATEWAY_ADDRESS" "$GATEWAY_MAC" eth_origin -D "$BRIDGE_NAME" "$GATEWAY_ID" "$GATEWAY_ADDRESS" "$GATEWAY_MAC"
{% endif %}
} }
{% if br.gateways is defined and br.gateways %} {% if br.gateways is defined and br.gateways %}
......
...@@ -11,8 +11,10 @@ export BRIDGE_NAME={{br.name}} ...@@ -11,8 +11,10 @@ export BRIDGE_NAME={{br.name}}
{% for link in br.links %} {% for link in br.links %}
# link {{link}} # link {{link}}
{% if not (br.noWaitUp | default(false)) %}
## Ensure link is up ## Ensure link is up
_wait_for_interface_online "{{link}}" _wait_for_interface_online "{{link}}"
{% endif %}
{% if br.macvlan is defined and br.macvlan %} {% if br.macvlan is defined and br.macvlan %}
## macvlan {{br.name}}{{link | regex_replace('\.', '')}} of {{link}} ## macvlan {{br.name}}{{link | regex_replace('\.', '')}} of {{link}}
......
...@@ -6,7 +6,7 @@ services: ...@@ -6,7 +6,7 @@ services:
{% if br.dhcpv6Receive is defined and br.dhcpv6Receive %} {% if br.dhcpv6Receive is defined and br.dhcpv6Receive %}
dhcpv6-{{srcbr.name}}-{{br.name}}: dhcpv6-{{srcbr.name}}-{{br.name}}:
restart: always restart: always
image: git-registry.mycard.moe/nanahira/docker-dhcpv6-client image: git-registry.moenext.com/nanahira/docker-dhcpv6-client
network_mode: host network_mode: host
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
...@@ -23,7 +23,7 @@ services: ...@@ -23,7 +23,7 @@ services:
{% for br in bridges %} {% for br in bridges %}
{% if br.dhcpv6Receive is defined and br.dhcpv6Receive %} {% if br.dhcpv6Receive is defined and br.dhcpv6Receive %}
dhcpv6-ppp{{ppp.id}}-{{br.name}}: dhcpv6-ppp{{ppp.id}}-{{br.name}}:
image: git-registry.mycard.moe/nanahira/docker-dhcpv6-client image: git-registry.moenext.com/nanahira/docker-dhcpv6-client
network_mode: host network_mode: host
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
......
...@@ -3,7 +3,7 @@ services: ...@@ -3,7 +3,7 @@ services:
{% if not (smartdns.external is defined and smartdns.external) %} {% if not (smartdns.external is defined and smartdns.external) %}
smartdns: smartdns:
restart: always restart: always
image: git-registry.mycard.moe/nanahira/docker-smartdns image: git-registry.moenext.com/nanahira/docker-smartdns
network_mode: host network_mode: host
command: -f -x -c /etc/smartdns/smartdns.conf command: -f -x -c /etc/smartdns/smartdns.conf
volumes: volumes:
...@@ -12,7 +12,7 @@ services: ...@@ -12,7 +12,7 @@ services:
{% endif %} {% endif %}
dnsmasq: dnsmasq:
restart: always restart: always
image: git-registry.mycard.moe/nanahira/dnsmasq:original image: git-registry.moenext.com/nanahira/dnsmasq:original
network_mode: host network_mode: host
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
......
...@@ -88,8 +88,12 @@ iface {{vlan.link}}.{{vlan.tag}} inet6 manual ...@@ -88,8 +88,12 @@ iface {{vlan.link}}.{{vlan.tag}} inet6 manual
{% for br in bridges %} {% for br in bridges %}
## {{br.name}} ## {{br.name}}
{% if br.async | default(false) %}
auto {{br.name}} &
{% else %}
auto {{br.name}} auto {{br.name}}
allow-hotplug {{br.name}} allow-hotplug {{br.name}}
{% endif %}
iface {{br.name}} inet {{br.type}} iface {{br.name}} inet {{br.type}}
{% if not (br.direct is defined and br.direct) %} {% if not (br.direct is defined and br.direct) %}
{% if br.links is defined and br.links and br.links | length > 0 %} {% if br.links is defined and br.links and br.links | length > 0 %}
...@@ -140,8 +144,12 @@ mtu {{br.mtu}} ...@@ -140,8 +144,12 @@ mtu {{br.mtu}}
{% if ppps is defined and ppps %} {% if ppps is defined and ppps %}
{% for ppp in ppps %} {% for ppp in ppps %}
## ppp{{ppp.id}} ## ppp{{ppp.id}}
{% if br.async | default(false) %}
auto ppp{{ppp.id}} &
{% else %}
auto ppp{{ppp.id}} auto ppp{{ppp.id}}
allow-hotplug ppp{{ppp.id}} allow-hotplug ppp{{ppp.id}}
{% endif %}
iface ppp{{ppp.id}} inet ppp iface ppp{{ppp.id}} inet ppp
pre-up {{ansible_user_dir}}/nextgen-router/scripts/ppp{{ppp.id}}/pre-up.sh pre-up {{ansible_user_dir}}/nextgen-router/scripts/ppp{{ppp.id}}/pre-up.sh
post-down {{ansible_user_dir}}/nextgen-router/scripts/ppp{{ppp.id}}/post-down.sh post-down {{ansible_user_dir}}/nextgen-router/scripts/ppp{{ppp.id}}/post-down.sh
......
...@@ -2,12 +2,12 @@ version: '2.4' ...@@ -2,12 +2,12 @@ version: '2.4'
services: services:
lldpd: lldpd:
restart: always restart: always
image: git-registry.mycard.moe/nanahira/docker-lldp image: git-registry.moenext.com/nanahira/docker-lldp
network_mode: host network_mode: host
{% if gdut is defined and gdut %} {% if gdut is defined and gdut %}
drcom: drcom:
restart: always restart: always
image: git-registry.mycard.moe/nanahira/gdut-drcom image: git-registry.moenext.com/nanahira/gdut-drcom
network_mode: host network_mode: host
command: --remote-ip {{gdut.remote}} --keep-alive1-flag {{gdut.flag}} --enable-crypt 1 command: --remote-ip {{gdut.remote}} --keep-alive1-flag {{gdut.flag}} --enable-crypt 1
{% endif %} {% endif %}
...@@ -24,7 +24,7 @@ services: ...@@ -24,7 +24,7 @@ services:
{% if dnsmasq.aptCacher is defined and (dnsmasq.aptCacher == "localhost" or (dnsmasq.aptCacher.localhost is defined and dnsmasq.aptCacher.localhost)) %} {% if dnsmasq.aptCacher is defined and (dnsmasq.aptCacher == "localhost" or (dnsmasq.aptCacher.localhost is defined and dnsmasq.aptCacher.localhost)) %}
apt-cacher-ng: apt-cacher-ng:
restart: always restart: always
image: git-registry.mycard.moe/nanahira/apt-cacher-ng-docker:latest image: git-registry.moenext.com/nanahira/apt-cacher-ng-docker:latest
environment: environment:
UPSTREAM_MIRROR: {{ dnsmasq.aptCacher.upstream | default('http://mirrors.tuna.tsinghua.edu.cn') }} UPSTREAM_MIRROR: {{ dnsmasq.aptCacher.upstream | default('http://mirrors.tuna.tsinghua.edu.cn') }}
ports: ports:
...@@ -50,7 +50,7 @@ services: ...@@ -50,7 +50,7 @@ services:
- ./pxe/menus:/data - ./pxe/menus:/data
pxe-nginx: pxe-nginx:
restart: always restart: always
image: git-registry.mycard.moe/nanahira/docker-nginx-plus image: git-registry.moenext.com/nanahira/docker-nginx-plus
ports: ports:
- '{{services.address}}:16980:16980' - '{{services.address}}:16980:16980'
volumes: volumes:
......
...@@ -51,15 +51,15 @@ ...@@ -51,15 +51,15 @@
name: '{{item}}' name: '{{item}}'
source: pull source: pull
with_items: with_items:
- git-registry.mycard.moe/nanahira/docker-smartdns - git-registry.moenext.com/nanahira/docker-smartdns
- git-registry.mycard.moe/nanahira/dnsmasq:original - git-registry.moenext.com/nanahira/dnsmasq:original
- git-registry.mycard.moe/nanahira/docker-dhcpv6-client - git-registry.moenext.com/nanahira/docker-dhcpv6-client
- git-registry.mycard.moe/nanahira/docker-lldp - git-registry.moenext.com/nanahira/docker-lldp
- git-registry.mycard.moe/nanahira/gdut-drcom - git-registry.moenext.com/nanahira/gdut-drcom
- teddysun/kms - teddysun/kms
- git-registry.mycard.moe/nanahira/apt-cacher-ng-docker:latest - git-registry.moenext.com/nanahira/apt-cacher-ng-docker:latest
- wastrachan/tftpd - wastrachan/tftpd
- git-registry.mycard.moe/nanahira/docker-nginx-plus - git-registry.moenext.com/nanahira/docker-nginx-plus
- oznu/cloudflare-ddns - oznu/cloudflare-ddns
- cturra/ntp - cturra/ntp
handlers: handlers:
......
- name: pull images - name: Define Docker images array
docker_image: set_fact:
name: '{{item}}' mcnetwork_docker_images:
source: pull - git-registry.moenext.com/railgun/gateways-monitor
with_items: - git-registry.moenext.com/railgun/babeld
- git-registry.mycard.moe/railgun/gateways-monitor - git-registry.moenext.com/railgun/ocserv
- git-registry.mycard.moe/railgun/babeld - git-registry.moenext.com/railgun/openconnect
- git-registry.mycard.moe/railgun/ocserv - git-registry.moenext.com/nanahira/gost
- git-registry.mycard.moe/railgun/openconnect - git-registry.moenext.com/railgun/tun:new
- git-registry.mycard.moe/nanahira/gost # - git-registry.moenext.com/railgun/railgun-routing-client
- git-registry.mycard.moe/railgun/tun:new - name: Add warp-proxy image to mcnetwork_docker_images if architecture is x86_64
#- git-registry.mycard.moe/railgun/railgun-routing-client set_fact:
- name: image for arp mcnetwork_docker_images: "{{ mcnetwork_docker_images + ['git-registry.moenext.com/nanahira/warp-proxy'] }}"
when: ansible_architecture == 'x86_64'
- name: Pull Docker images
docker_image: docker_image:
name: git-registry.mycard.moe/nanahira/warp-proxy name: '{{ item }}'
source: pull source: pull
when: ansible_architecture == 'x86_64' with_items: "{{ mcnetwork_docker_images }}"
- name: Tag Docker images
shell: |
{% for image in mcnetwork_docker_images %}
docker tag {{ image }} {{ image | regex_replace('git-registry.moenext.com', 'git-registry.mycard.moe') }}
{% endfor %}
changed_when: false
- name: debian packages - name: debian packages
become: true become: true
apt: apt:
......
...@@ -47,6 +47,9 @@ vars: ...@@ -47,6 +47,9 @@ vars:
file: somefile.txt file: somefile.txt
address: 10.0.0.4 address: 10.0.0.4
interfaces_custom: '' # 自定义条目 interfaces_custom: '' # 自定义条目
noWaitUp: false # 不等待链路有效
noOrigin: false # 不设置源进源出规则
async: false # 异步启动,不等待系统开机
- name: brwan - name: brwan
links: links:
- bond0.2 - bond0.2
......
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