Commit d7b4cfc7 authored by nanahira's avatar nanahira

add up/down script and change mac changing

parent 4c2aedf0
#!/bin/bash
source {{ansible_user_dir}}/nextgen-router/scripts/utility.sh
export BRIDGE_NAME={{br.name}}
{% if br.mac is defined and br.mac %}
# Change mac
export BRIDGE_MAC={{br.mac}}
export BR
ip link set "$BRIDGE_NAME" address "$BRIDGE_MAC"
{% endif %}
true
#!/bin/bash #!/bin/bash
source {{ansible_user_dir}}/nextgen-router/scripts/utility.sh source {{ansible_user_dir}}/nextgen-router/scripts/utility.sh
export BRIDGE_NAME={{br.name}}
{% if br.macvlan is defined and br.macvlan %} {% if br.macvlan is defined and br.macvlan %}
# macvlans # macvlans
......
#!/bin/bash #!/bin/bash
source {{ansible_user_dir}}/nextgen-router/scripts/utility.sh source {{ansible_user_dir}}/nextgen-router/scripts/utility.sh
export BRIDGE_NAME={{br.name}} export BRIDGE_NAME={{br.name}}
{% if br.address is defined and br.address %} {% if br.address is defined and br.address %}
export BRIDGE_ADDRESS={{br.address}} export BRIDGE_ADDRESS={{br.address}}
{% endif %} {% endif %}
...@@ -10,7 +10,7 @@ export BRIDGE_ADDRESS={{br.address}} ...@@ -10,7 +10,7 @@ export BRIDGE_ADDRESS={{br.address}}
{% if br.mac is defined and br.mac %} {% if br.mac is defined and br.mac %}
# Change mac # Change mac
export BRIDGE_MAC={{br.mac}} export BRIDGE_MAC={{br.mac}}
ip link set "$BRIDGE_NAME" address "$BRIDGE_MAC" # ip link set "$BRIDGE_NAME" address "$BRIDGE_MAC"
{% endif %} {% endif %}
{% if br.moreAddresses is defined and br.moreAddresses %} {% if br.moreAddresses is defined and br.moreAddresses %}
......
#!/bin/bash #!/bin/bash
source {{ansible_user_dir}}/nextgen-router/scripts/utility.sh source {{ansible_user_dir}}/nextgen-router/scripts/utility.sh
export BRIDGE_NAME={{br.name}} export BRIDGE_NAME={{br.name}}
{% if br.address is defined and br.address %} {% if br.address is defined and br.address %}
export BRIDGE_ADDRESS={{br.address}} export BRIDGE_ADDRESS={{br.address}}
{% endif %} {% endif %}
......
#!/bin/bash #!/bin/bash
source {{ansible_user_dir}}/nextgen-router/scripts/utility.sh source {{ansible_user_dir}}/nextgen-router/scripts/utility.sh
export BRIDGE_NAME={{br.name}}
{% if br.macvlan is defined and br.macvlan %} {% if br.macvlan is defined and br.macvlan %}
# macvlans # macvlans
...@@ -16,4 +17,10 @@ ip link set {{br.name}}-{{link | regex_replace('\.', '-')}} up ...@@ -16,4 +17,10 @@ ip link set {{br.name}}-{{link | regex_replace('\.', '-')}} up
{{br.linkUp}} {{br.linkUp}}
{% endif %} {% endif %}
{% if br.mac is defined and br.mac %}
# Change mac
export BRIDGE_MAC={{br.mac}}
# ip link set "$BRIDGE_NAME" address "$BRIDGE_MAC"
{% endif %}
true true
#!/bin/bash
source {{ansible_user_dir}}/nextgen-router/scripts/utility.sh
export BRIDGE_NAME={{br.name}}
{% if br.mac is defined and br.mac %}
# Change mac
export BRIDGE_MAC={{br.mac}}
ip link set "$BRIDGE_NAME" address "$BRIDGE_MAC"
{% endif %}
true
...@@ -90,8 +90,9 @@ metric 9999 ...@@ -90,8 +90,9 @@ metric 9999
{% endif %} {% endif %}
{% endif %} {% endif %}
pre-up {{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/pre-up.sh pre-up {{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/pre-up.sh
up {{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/up.sh
post-up {{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/post-up.sh post-up {{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/post-up.sh
pre-down {{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/pre-down.sh down {{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/down.sh
post-down {{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/post-down.sh post-down {{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/post-down.sh
{% if br.mtu is defined and br.mtu %} {% if br.mtu is defined and br.mtu %}
mtu {{br.mtu}} mtu {{br.mtu}}
......
...@@ -7,6 +7,11 @@ ...@@ -7,6 +7,11 @@
src: ./files/bridge-post-scripts/pre-up.sh.j2 src: ./files/bridge-post-scripts/pre-up.sh.j2
dest: '{{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/pre-up.sh' dest: '{{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/pre-up.sh'
mode: 0755 mode: 0755
- name: up script
template:
src: ./files/bridge-post-scripts/up.sh.j2
dest: '{{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/up.sh'
mode: 0755
- name: post-up script - name: post-up script
template: template:
src: ./files/bridge-post-scripts/post-up.sh.j2 src: ./files/bridge-post-scripts/post-up.sh.j2
...@@ -22,3 +27,8 @@ ...@@ -22,3 +27,8 @@
src: ./files/bridge-post-scripts/post-down.sh.j2 src: ./files/bridge-post-scripts/post-down.sh.j2
dest: '{{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/post-down.sh' dest: '{{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/post-down.sh'
mode: 0755 mode: 0755
- name: down script
template:
src: ./files/bridge-post-scripts/down.sh.j2
dest: '{{ansible_user_dir}}/nextgen-router/scripts/{{br.name}}/down.sh'
mode: 0755
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