Compare commits
No commits in common. "8016aec966ea46b2f442d4134a4ba0e851c5c8e9" and "4c01378119dd38c922784e48deeafe0cde2934f7" have entirely different histories.
8016aec966
...
4c01378119
@ -1,2 +0,0 @@
|
||||
# ansible-networkconfig
|
||||
This repo is intended to be used as an ansible role
|
17
files/ovsovn.service
Normal file
17
files/ovsovn.service
Normal file
@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=OpenVSwitch and OVN Controller service
|
||||
After=network-pre.target systemd-udev-settle.service
|
||||
Before=networking.service
|
||||
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RestartSec=5
|
||||
RemainAfterExit=true
|
||||
|
||||
ExecStart=/usr/sbin/ovsovn-service-manager.sh START
|
||||
ExecStop=/usr/sbin/ovsovn-service-manager.sh STOP
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
BIN
files/ubuntu18/libopenvswitch-dev_2.14.0-1_amd64.deb
Normal file
BIN
files/ubuntu18/libopenvswitch-dev_2.14.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu18/libopenvswitch_2.14.0-1_amd64.deb
Normal file
BIN
files/ubuntu18/libopenvswitch_2.14.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu18/openvswitch-common_2.14.0-1_amd64.deb
Normal file
BIN
files/ubuntu18/openvswitch-common_2.14.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu18/openvswitch-datapath-dkms_2.14.0-1_all.deb
Normal file
BIN
files/ubuntu18/openvswitch-datapath-dkms_2.14.0-1_all.deb
Normal file
Binary file not shown.
BIN
files/ubuntu18/openvswitch-datapath-source_2.14.0-1_all.deb
Normal file
BIN
files/ubuntu18/openvswitch-datapath-source_2.14.0-1_all.deb
Normal file
Binary file not shown.
BIN
files/ubuntu18/openvswitch-dbg_2.14.0-1_amd64.deb
Normal file
BIN
files/ubuntu18/openvswitch-dbg_2.14.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu18/openvswitch-ipsec_2.14.0-1_amd64.deb
Normal file
BIN
files/ubuntu18/openvswitch-ipsec_2.14.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu18/openvswitch-pki_2.14.0-1_all.deb
Normal file
BIN
files/ubuntu18/openvswitch-pki_2.14.0-1_all.deb
Normal file
Binary file not shown.
BIN
files/ubuntu18/openvswitch-switch_2.14.0-1_amd64.deb
Normal file
BIN
files/ubuntu18/openvswitch-switch_2.14.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu18/openvswitch-test_2.14.0-1_all.deb
Normal file
BIN
files/ubuntu18/openvswitch-test_2.14.0-1_all.deb
Normal file
Binary file not shown.
BIN
files/ubuntu18/openvswitch-testcontroller_2.14.0-1_amd64.deb
Normal file
BIN
files/ubuntu18/openvswitch-testcontroller_2.14.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu18/openvswitch-vtep_2.14.0-1_amd64.deb
Normal file
BIN
files/ubuntu18/openvswitch-vtep_2.14.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu18/ovn_20.09.0-1_amd64.deb
Normal file
BIN
files/ubuntu18/ovn_20.09.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu18/python3-openvswitch_2.14.0-1_all.deb
Normal file
BIN
files/ubuntu18/python3-openvswitch_2.14.0-1_all.deb
Normal file
Binary file not shown.
BIN
files/ubuntu20/libopenvswitch-dev_2.14.0-1_amd64.deb
Normal file
BIN
files/ubuntu20/libopenvswitch-dev_2.14.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu20/libopenvswitch_2.14.0-1_amd64.deb
Normal file
BIN
files/ubuntu20/libopenvswitch_2.14.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu20/openvswitch-common_2.14.0-1_amd64.deb
Normal file
BIN
files/ubuntu20/openvswitch-common_2.14.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu20/openvswitch-datapath-dkms_2.14.0-1_all.deb
Normal file
BIN
files/ubuntu20/openvswitch-datapath-dkms_2.14.0-1_all.deb
Normal file
Binary file not shown.
BIN
files/ubuntu20/openvswitch-datapath-source_2.14.0-1_all.deb
Normal file
BIN
files/ubuntu20/openvswitch-datapath-source_2.14.0-1_all.deb
Normal file
Binary file not shown.
BIN
files/ubuntu20/openvswitch-dbg_2.14.0-1_amd64.deb
Normal file
BIN
files/ubuntu20/openvswitch-dbg_2.14.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu20/openvswitch-ipsec_2.14.0-1_amd64.deb
Normal file
BIN
files/ubuntu20/openvswitch-ipsec_2.14.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu20/openvswitch-pki_2.14.0-1_all.deb
Normal file
BIN
files/ubuntu20/openvswitch-pki_2.14.0-1_all.deb
Normal file
Binary file not shown.
BIN
files/ubuntu20/openvswitch-switch_2.14.0-1_amd64.deb
Normal file
BIN
files/ubuntu20/openvswitch-switch_2.14.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu20/openvswitch-test_2.14.0-1_all.deb
Normal file
BIN
files/ubuntu20/openvswitch-test_2.14.0-1_all.deb
Normal file
Binary file not shown.
BIN
files/ubuntu20/openvswitch-testcontroller_2.14.0-1_amd64.deb
Normal file
BIN
files/ubuntu20/openvswitch-testcontroller_2.14.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu20/openvswitch-vtep_2.14.0-1_amd64.deb
Normal file
BIN
files/ubuntu20/openvswitch-vtep_2.14.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu20/ovn_20.09.0-1_amd64.deb
Normal file
BIN
files/ubuntu20/ovn_20.09.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ubuntu20/python3-openvswitch_2.14.0-1_all.deb
Normal file
BIN
files/ubuntu20/python3-openvswitch_2.14.0-1_all.deb
Normal file
Binary file not shown.
@ -1,4 +1,3 @@
|
||||
---
|
||||
|
||||
- name: restart frr-docker
|
||||
action: service name=frr-docker enabled=yes state=restarted
|
||||
- name: restart ovsovn.service
|
||||
action: service name=ovsovn enabled=yes state=restarted
|
||||
|
152
tasks/main.yml
152
tasks/main.yml
@ -1,58 +1,94 @@
|
||||
- name: Install required system packages
|
||||
apt: name={{ item }} state=present update_cache=yes
|
||||
loop: [
|
||||
'ifupdown',
|
||||
'ifenslave',
|
||||
]
|
||||
tags: interfaces
|
||||
|
||||
- name: Configure /etc/network/interfaces
|
||||
template:
|
||||
src: templates/interfaces.j2
|
||||
dest: /etc/network/interfaces
|
||||
backup: yes
|
||||
tags: interfaces
|
||||
|
||||
- name: Remove /etc/network/interfaces.d/eth0
|
||||
file:
|
||||
path: /etc/network/interfaces.d/eth0
|
||||
state: absent
|
||||
tags: interfaces
|
||||
|
||||
- name: Remove /etc/netplan/01-netcfg.yaml
|
||||
file:
|
||||
path: /etc/netplan/01-netcfg.yaml
|
||||
state: absent
|
||||
tags: interfaces
|
||||
|
||||
- name: Remove /etc/netplan/50-cloud-init.yaml
|
||||
file:
|
||||
path: /etc/netplan/50-cloud-init.yaml
|
||||
state: absent
|
||||
tags: interfaces
|
||||
|
||||
- name: Add the bonding module
|
||||
modprobe:
|
||||
name: bonding
|
||||
state: present
|
||||
tags: interfaces
|
||||
|
||||
- name: Add the 8021q module
|
||||
modprobe:
|
||||
name: 8021q
|
||||
state: present
|
||||
tags: interfaces
|
||||
|
||||
- name: Make sure 8021q\dot1q makes it into /etc/modules for loading at boot time
|
||||
lineinfile:
|
||||
path: /etc/modules
|
||||
state: present
|
||||
line: '8021q'
|
||||
tags: interfaces
|
||||
|
||||
- name: Make sure bonding makes it into /etc/modules for loading at boot time
|
||||
lineinfile:
|
||||
path: /etc/modules
|
||||
state: present
|
||||
line: 'bonding'
|
||||
tags: interfaces
|
||||
#OVS Version 2.13.0 \ Ubuntu 18
|
||||
#ovsdb_server_md5_value: "f0a820cb40824c3a9f87f57644037d64"
|
||||
#OVN Version 20.06.0 \ Ubuntu 18
|
||||
#ovn_nbctl_md5_value: "4310864bd9676925a49909013071cbec"
|
||||
|
||||
#OVS Version 2.14.0 \ Ubuntu 18
|
||||
#ovsdb_server_md5_value: "ffd9ba2a6b3da6108d7eb97c70e51761"
|
||||
#OVN Version 20.09.0 \ Ubuntu 18
|
||||
#ovn_nbctl_md5_value: "031e770fd969617c221b156726c2f1dc"
|
||||
|
||||
#OVS Version 2.14.0 \ Ubuntu 20
|
||||
#ovsdb_server_md5_value: "2183d20b8df5b5cb790aa238f6e1432e"
|
||||
#OVN Version 20.09.0 \ Ubuntu 20
|
||||
#ovn_nbctl_md5_value: "6007bc53bf30b8d4b4c0fab039ee576b"
|
||||
|
||||
|
||||
|
||||
- name: "Checking presense of OpenVsitch and comparing MD5 hash value"
|
||||
stat:
|
||||
path: /usr/sbin/ovsdb-server
|
||||
checksum_algorithm: md5
|
||||
register: ovsdb_server_exists
|
||||
|
||||
# This will ensure that all OpenvSwitch binaries are running the desired version, based on the MD5 value stored in the variables file
|
||||
# When releasing a new version of ovs, update this md5 an update the copy and install tasks below
|
||||
|
||||
- name: "Set fact to False"
|
||||
set_fact:
|
||||
force_new_ovs_download: False
|
||||
|
||||
- name: "Checking presense of OVN and comparing MD5 hash value"
|
||||
stat:
|
||||
path: /usr/bin/ovn-nbctl
|
||||
checksum_algorithm: md5
|
||||
register: ovn_nbctl_exists
|
||||
|
||||
# This will ensure that all OVN binaries are running the desired version, based on the MD5 value stored in the variables file
|
||||
# When releasing a new version of OVN, update this md5 an update the copy and install tasks below
|
||||
|
||||
- name: "Set fact to False"
|
||||
set_fact:
|
||||
force_new_ovn_download: False
|
||||
|
||||
|
||||
|
||||
|
||||
- name: Include tasks based on OS being Ubuntu 18
|
||||
include_tasks: ubuntu18.yml
|
||||
when:
|
||||
- ansible_distribution_major_version=="18"
|
||||
- ansible_distribution == "Ubuntu"
|
||||
tags: ceph
|
||||
|
||||
- name: Include tasks based on OS being Ubuntu 20
|
||||
include_tasks: ubuntu20.yml
|
||||
when:
|
||||
- ansible_distribution_major_version=="20"
|
||||
- ansible_distribution == "Ubuntu"
|
||||
tags: ceph
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#Install the custom service to start OVS and OVN as required
|
||||
- name: "Copy /usr/sbin/ovsovn-service-manager.sh file"
|
||||
template:
|
||||
src: ovsovn-service-manager.sh.j2
|
||||
dest: "/usr/sbin/ovsovn-service-manager.sh"
|
||||
mode: +x
|
||||
notify:
|
||||
- restart ovsovn.service
|
||||
tags: service
|
||||
|
||||
- name: "Configure ovsovn.service"
|
||||
action: template src=files/ovsovn.service dest=/etc/systemd/system/ovsovn.service backup=no
|
||||
notify:
|
||||
- restart ovsovn.service
|
||||
tags: service
|
||||
|
||||
- name: "Reload systemctl then enable & start ovsovn service"
|
||||
systemd:
|
||||
state: started
|
||||
enabled: True
|
||||
daemon_reload: yes
|
||||
name: ovsovn.service
|
||||
tags: service
|
||||
|
91
tasks/ubuntu18.yml
Normal file
91
tasks/ubuntu18.yml
Normal file
@ -0,0 +1,91 @@
|
||||
|
||||
- name: set ovsdb_server_md5_value fact
|
||||
set_fact:
|
||||
ovsdb_server_md5_value: "ffd9ba2a6b3da6108d7eb97c70e51761"
|
||||
|
||||
- name: set ovn_nbctl_md5_value fact
|
||||
set_fact:
|
||||
ovn_nbctl_md5_value: "031e770fd969617c221b156726c2f1dc"
|
||||
|
||||
|
||||
- name: "Set fact to true if the source file exists but the MD5 sum does not match"
|
||||
set_fact:
|
||||
force_new_ovs_download: "{{ ovsdb_server_exists.stat.checksum != ovsdb_server_md5_value }}"
|
||||
when: ovsdb_server_exists.stat.exists
|
||||
|
||||
|
||||
- name: "Set fact to true if the source file does not exist"
|
||||
set_fact:
|
||||
force_new_ovs_download: True
|
||||
when: not ovsdb_server_exists.stat.exists
|
||||
|
||||
- name: Debug out force_new_ovs_download
|
||||
debug: msg="Installing OpenVSwitch"
|
||||
when: force_new_ovs_download
|
||||
|
||||
- name: Debug out force_new_ovs_download
|
||||
debug: msg="NOT Installing OpenVSwitch, MD5 sum matches"
|
||||
when: not force_new_ovs_download
|
||||
|
||||
- name: "Copy OVN binaries"
|
||||
copy:
|
||||
src: "ubuntu18/{{ item }}"
|
||||
dest: "/tmp/{{ item }}"
|
||||
with_items:
|
||||
- libopenvswitch_2.14.0-1_amd64.deb
|
||||
- openvswitch-common_2.14.0-1_amd64.deb
|
||||
- openvswitch-switch_2.14.0-1_amd64.deb
|
||||
when: force_new_ovs_download
|
||||
|
||||
|
||||
|
||||
|
||||
- name: "Install packages"
|
||||
apt:
|
||||
deb: "{{ item }}"
|
||||
with_items:
|
||||
- "/tmp/libopenvswitch_2.14.0-1_amd64.deb"
|
||||
- "/tmp/openvswitch-common_2.14.0-1_amd64.deb"
|
||||
- "/tmp/openvswitch-switch_2.14.0-1_amd64.deb"
|
||||
when: force_new_ovs_download
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
- name: "Set fact to true if the source file exists but the MD5 sum does not match"
|
||||
set_fact:
|
||||
force_new_ovn_download: "{{ ovn_nbctl_exists.stat.checksum != ovn_nbctl_md5_value }}"
|
||||
when: ovn_nbctl_exists.stat.exists
|
||||
|
||||
#- debug: msg={{ovn_nbctl_md5_value}}
|
||||
#- debug: msg={{ovn_nbctl_exists}}
|
||||
|
||||
- name: "Set fact to true if the source file does not exist"
|
||||
set_fact:
|
||||
force_new_ovn_download: True
|
||||
when: not ovn_nbctl_exists.stat.exists
|
||||
|
||||
- debug: msg="Installing OVN"
|
||||
when: force_new_ovn_download
|
||||
|
||||
- debug: msg="NOT Installing OVN, MD5 sum matches"
|
||||
when: not force_new_ovn_download
|
||||
|
||||
- name: "Copy OVN binaries"
|
||||
copy:
|
||||
src: "ubuntu18/{{ item }}"
|
||||
dest: "/tmp/{{ item }}"
|
||||
with_items:
|
||||
- ovn_20.09.0-1_amd64.deb
|
||||
when: force_new_ovn_download
|
||||
|
||||
- name: "Install packages"
|
||||
apt:
|
||||
deb: "{{ item }}"
|
||||
with_items:
|
||||
- "/tmp/ovn_20.09.0-1_amd64.deb"
|
||||
when: force_new_ovn_download
|
89
tasks/ubuntu20.yml
Normal file
89
tasks/ubuntu20.yml
Normal file
@ -0,0 +1,89 @@
|
||||
- name: set ovsdb_server_md5_value fact
|
||||
set_fact:
|
||||
ovsdb_server_md5_value: "2183d20b8df5b5cb790aa238f6e1432e"
|
||||
|
||||
- name: set ovn_nbctl_md5_value fact
|
||||
set_fact:
|
||||
ovn_nbctl_md5_value: "6007bc53bf30b8d4b4c0fab039ee576b"
|
||||
|
||||
- name: "Set fact to true if the source file exists but the MD5 sum does not match"
|
||||
set_fact:
|
||||
force_new_ovs_download: "{{ ovsdb_server_exists.stat.checksum != ovsdb_server_md5_value }}"
|
||||
when: ovsdb_server_exists.stat.exists
|
||||
|
||||
|
||||
- name: "Set fact to true if the source file does not exist"
|
||||
set_fact:
|
||||
force_new_ovs_download: True
|
||||
when: not ovsdb_server_exists.stat.exists
|
||||
|
||||
- name: Debug out force_new_ovs_download
|
||||
debug: msg="Installing OpenVSwitch"
|
||||
when: force_new_ovs_download
|
||||
|
||||
- name: Debug out force_new_ovs_download
|
||||
debug: msg="NOT Installing OpenVSwitch, MD5 sum matches"
|
||||
when: not force_new_ovs_download
|
||||
|
||||
- name: "Copy OVN binaries"
|
||||
copy:
|
||||
src: "ubuntu20/{{ item }}"
|
||||
dest: "/tmp/{{ item }}"
|
||||
with_items:
|
||||
- libopenvswitch_2.14.0-1_amd64.deb
|
||||
- openvswitch-common_2.14.0-1_amd64.deb
|
||||
- openvswitch-switch_2.14.0-1_amd64.deb
|
||||
when: force_new_ovs_download
|
||||
|
||||
|
||||
|
||||
|
||||
- name: "Install packages"
|
||||
apt:
|
||||
deb: "{{ item }}"
|
||||
with_items:
|
||||
- "/tmp/libopenvswitch_2.14.0-1_amd64.deb"
|
||||
- "/tmp/openvswitch-common_2.14.0-1_amd64.deb"
|
||||
- "/tmp/openvswitch-switch_2.14.0-1_amd64.deb"
|
||||
when: force_new_ovs_download
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
- name: "Set fact to true if the source file exists but the MD5 sum does not match"
|
||||
set_fact:
|
||||
force_new_ovn_download: "{{ ovn_nbctl_exists.stat.checksum != ovn_nbctl_md5_value }}"
|
||||
when: ovn_nbctl_exists.stat.exists and use_ovn
|
||||
|
||||
#- debug: msg={{ovn_nbctl_md5_value}}
|
||||
#- debug: msg={{ovn_nbctl_exists}}
|
||||
|
||||
- name: "Set fact to true if the source file does not exist"
|
||||
set_fact:
|
||||
force_new_ovn_download: True
|
||||
when: not ovn_nbctl_exists.stat.exists and use_ovn
|
||||
|
||||
- debug: msg="Installing OVN"
|
||||
when: force_new_ovn_download and use_ovn
|
||||
|
||||
- debug: msg="NOT Installing OVN, MD5 sum matches"
|
||||
when: not force_new_ovn_download and use_ovn
|
||||
|
||||
- name: "Copy OVN binaries"
|
||||
copy:
|
||||
src: "ubuntu20/{{ item }}"
|
||||
dest: "/tmp/{{ item }}"
|
||||
with_items:
|
||||
- ovn_20.06.0-1_amd64.deb
|
||||
when: force_new_ovn_download and use_ovn
|
||||
|
||||
- name: "Install packages"
|
||||
apt:
|
||||
deb: "{{ item }}"
|
||||
with_items:
|
||||
- "/tmp/ovn_20.06.0-1_amd64.deb"
|
||||
when: force_new_ovn_download and use_ovn
|
@ -1,127 +0,0 @@
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
{% if host_loopback_IP is defined %}
|
||||
auto lo:1
|
||||
iface lo:1 inet static
|
||||
address {{host_loopback_IP}}/32
|
||||
{% endif %}
|
||||
|
||||
{% if OOBNET_NIC is defined %}
|
||||
auto {{OOBNET_NIC}}
|
||||
allow-hotplug {{OOBNET_NIC}}
|
||||
iface {{OOBNET_NIC}} inet static
|
||||
address {{OOBNET_IP}}/{{OOBNET_Netmask}}
|
||||
{% if OOBNET_GW is defined %}gateway {{OOBNET_GW}}{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if autobgp_interfaces is defined %}
|
||||
{% for item in autobgp_interfaces %}
|
||||
|
||||
auto {{ item['name'] }}
|
||||
allow-hotplug {{ item['name'] }}
|
||||
iface {{ item['name'] }} inet static
|
||||
address {{host_loopback_IP}}/32
|
||||
{% if item['mtu'] is defined %}
|
||||
mtu {{ item['mtu'] }}
|
||||
{% endif %}
|
||||
{% if item['force10G'] is defined and item['force10G']|lower == "true" %}
|
||||
#Force speed to 10G
|
||||
post-up sudo ethtool -s {{ item['name'] }} autoneg off
|
||||
post-up sudo ethtool -s {{ item['name'] }} speed 10000
|
||||
{% endif %}
|
||||
{% if item['force40G'] is defined and item['force40G']|lower == "true" %}
|
||||
#Force speed to 40G
|
||||
pre-up sudo ethtool -s {{ item['name'] }} autoneg off
|
||||
pre-up sudo ethtool -s {{ item['name'] }} speed 40000
|
||||
{% endif %}
|
||||
{% if item['auto40G'] is defined and item['auto40G']|lower == "true" %}
|
||||
#Auto speed
|
||||
pre-up sudo /bin/ip link set down {{ item['name'] }} && sleep 1
|
||||
pre-up sudo ethtool -s {{ item['name'] }} speed 40000 duplex full autoneg on
|
||||
post-up sudo /bin/ip link set up {{ item['name'] }}
|
||||
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if addressed_interfaces is defined and addressed_interfaces != [] %}
|
||||
{% for item in addressed_interfaces %}
|
||||
|
||||
auto {{ item['name'] }}
|
||||
allow-hotplug {{ item['name'] }}
|
||||
iface {{ item['name'] }} inet static
|
||||
address {{item['ip_address']}}/{{item['ip_netmask']}}
|
||||
{% if item['mtu'] is defined %}
|
||||
mtu {{ item['mtu'] }}
|
||||
{% endif %}
|
||||
{% if item['ip_gateway'] is defined %}
|
||||
gateway {{item['ip_gateway']}}
|
||||
{% endif %}
|
||||
{% if item['force10G'] is defined and item['force10G']|lower == "true" %}
|
||||
post-up sudo ethtool -s {{ item['name'] }} autoneg off
|
||||
post-up sudo ethtool -s {{ item['name'] }} speed 10000
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if bond_interfaces is defined and bond_interfaces != [] %}
|
||||
{% for item in bond_interfaces %}
|
||||
{% for slave in item['slaves'] %}
|
||||
auto {{slave['name']}}
|
||||
iface {{slave['name']}} inet manual
|
||||
bond-master {{ item['name'] }}
|
||||
{% endfor %}
|
||||
|
||||
auto {{ item['name'] }}
|
||||
{% if item['ip_address'] is defined %}
|
||||
iface {{ item['name'] }} inet static
|
||||
address {{item['ip_address']}}/{{item['ip_netmask']}}
|
||||
{% else %}
|
||||
iface {{ item['name'] }} inet manual
|
||||
{% endif %}
|
||||
{% if item['ip_gateway'] is defined %}
|
||||
gateway {{item['ip_gateway']}}
|
||||
{% endif %}
|
||||
{% if item['mtu'] is defined %}
|
||||
mtu {{ item['mtu'] }}
|
||||
{% endif %}
|
||||
bond-mode active-backup
|
||||
bond-miimon 100
|
||||
bond-slaves none
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
{% if vlan_interfaces is defined and vlan_interfaces != [] %}
|
||||
{% for item in vlan_interfaces %}
|
||||
auto {{ item['name'] }}
|
||||
{% if item['ip_address'] is defined %}
|
||||
iface {{ item['name'] }} inet static
|
||||
address {{item['ip_address']}}/{{item['ip_netmask']}}
|
||||
{% else %}
|
||||
iface {{ item['name'] }} inet manual
|
||||
{% endif %}
|
||||
{% if item['ip_gateway'] is defined %}
|
||||
gateway {{item['ip_gateway']}}
|
||||
{% endif %}
|
||||
{% if item['mtu'] is defined %}
|
||||
mtu {{ item['mtu'] }}
|
||||
{% endif %}
|
||||
vlan-raw-device {{ item['vlan-raw-device'] }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{% if unused_interfaces is defined and unused_interfaces != [] %}
|
||||
{% for item in unused_interfaces %}
|
||||
|
||||
allow-hotplug {{ item['name'] }}
|
||||
iface {{ item['name'] }} inet manual
|
||||
{% endfor %}
|
||||
{% endif %}
|
63
templates/ovsovn-service-manager.sh.j2
Normal file
63
templates/ovsovn-service-manager.sh.j2
Normal file
@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Illegal number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
echo "Command recieved: $1"
|
||||
|
||||
START(){
|
||||
hostname=$(hostname)
|
||||
loopbackIP={{host_loopback_IP}}
|
||||
|
||||
|
||||
DIR="/var/run/openvswitch/db.sock"
|
||||
if [ -d "$DIR" ]; then
|
||||
rm -rf $DIR
|
||||
echo "Removed extraneous dir $DIR"
|
||||
fi
|
||||
|
||||
/usr/share/openvswitch/scripts/ovs-ctl start --system-id=$hostname
|
||||
echo "OVS started"
|
||||
#Instruct OVSDB to listen on 127.0.0.2:6640 so the ovs-vsctl command from within a container can access OpenVswitch
|
||||
ovs-appctl -t ovsdb-server ovsdb-server/add-remote ptcp:6640
|
||||
#ovs-vsctl del-br br-int
|
||||
|
||||
{% if use_ovn is defined and use_ovn == true %}
|
||||
echo "Starting OpenVSwitch and OVN on $hostname with $loopbackIP and pointing to OVN controller {{OVN_SB_Connection}}"
|
||||
ovs-vsctl set open . external-ids:ovn-bridge=br-int
|
||||
ovs-vsctl set open . external-ids:ovn-remote={{OVN_SB_Connection}}
|
||||
ovs-vsctl set open . external-ids:ovn-encap-type=geneve
|
||||
ovs-vsctl set open . external-ids:ovn-encap-ip=$loopbackIP
|
||||
/usr/share/ovn/scripts/ovn-ctl start_controller
|
||||
echo "OVS and OVN started"
|
||||
{% else %}
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if ansible_fqdn in groups['br_provider_nodes'] %}
|
||||
echo "Bringing online br-provider for WAN1"
|
||||
ovs-vsctl --may-exist add-br br-provider
|
||||
ovs-vsctl set open . external-ids:ovn-bridge-mappings=WAN1:br-provider
|
||||
ovs-vsctl --may-exist add-port br-provider bond0.11
|
||||
{% endif %}
|
||||
|
||||
|
||||
}
|
||||
STOP() {
|
||||
{% if use_ovn is defined and use_ovn == true %}
|
||||
echo "Stopping OVN"
|
||||
/usr/share/ovn/scripts/ovn-ctl stop_controller
|
||||
/usr/share/ovn/scripts/ovn-ctl stop_ovsdb
|
||||
echo "OpenVSwitch and OVN Stopped"
|
||||
{% else %}
|
||||
echo "Stopping OpenVSwitch"
|
||||
/usr/share/openvswitch/scripts/ovs-ctl stop
|
||||
echo "OpenVSwitch Stopped"
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
case $1 in
|
||||
START|STOP) "$1" ;;
|
||||
esac
|
Loading…
x
Reference in New Issue
Block a user