Data
This commit is contained in:
commit
1aacd141ff
BIN
files/libopenvswitch-dev_2.13.0-1_amd64.deb
Normal file
BIN
files/libopenvswitch-dev_2.13.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/libopenvswitch_2.13.0-1_amd64.deb
Normal file
BIN
files/libopenvswitch_2.13.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/openvswitch-common_2.13.0-1_amd64.deb
Normal file
BIN
files/openvswitch-common_2.13.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/openvswitch-datapath-dkms_2.13.0-1_all.deb
Normal file
BIN
files/openvswitch-datapath-dkms_2.13.0-1_all.deb
Normal file
Binary file not shown.
BIN
files/openvswitch-datapath-source_2.13.0-1_all.deb
Normal file
BIN
files/openvswitch-datapath-source_2.13.0-1_all.deb
Normal file
Binary file not shown.
BIN
files/openvswitch-dbg_2.13.0-1_amd64.deb
Normal file
BIN
files/openvswitch-dbg_2.13.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/openvswitch-ipsec_2.13.0-1_amd64.deb
Normal file
BIN
files/openvswitch-ipsec_2.13.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/openvswitch-pki_2.13.0-1_all.deb
Normal file
BIN
files/openvswitch-pki_2.13.0-1_all.deb
Normal file
Binary file not shown.
BIN
files/openvswitch-switch_2.13.0-1_amd64.deb
Normal file
BIN
files/openvswitch-switch_2.13.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/openvswitch-test_2.13.0-1_all.deb
Normal file
BIN
files/openvswitch-test_2.13.0-1_all.deb
Normal file
Binary file not shown.
BIN
files/openvswitch-testcontroller_2.13.0-1_amd64.deb
Normal file
BIN
files/openvswitch-testcontroller_2.13.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/openvswitch-vtep_2.13.0-1_amd64.deb
Normal file
BIN
files/openvswitch-vtep_2.13.0-1_amd64.deb
Normal file
Binary file not shown.
BIN
files/ovn_20.06.0-1_amd64.deb
Normal file
BIN
files/ovn_20.06.0-1_amd64.deb
Normal file
Binary file not shown.
14
files/ovsovn.service
Normal file
14
files/ovsovn.service
Normal file
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=ACS2 OpenVSwitch and OVN Controller service
|
||||
After=network.target
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
RestartSec=5
|
||||
|
||||
ExecStart=/usr/sbin/ovsovn-service-manager.sh START
|
||||
ExecStop=/usr/sbin/ovsovn-service-manager.sh STOP
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
BIN
files/python3-openvswitch_2.13.0-1_all.deb
Normal file
BIN
files/python3-openvswitch_2.13.0-1_all.deb
Normal file
Binary file not shown.
3
handlers/main.yml
Normal file
3
handlers/main.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
- name: restart ovsovn.service
|
||||
action: service name=ovsovn enabled=yes state=restarted
|
132
tasks/main.yml
Normal file
132
tasks/main.yml
Normal file
@ -0,0 +1,132 @@
|
||||
- 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: "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 == True
|
||||
|
||||
|
||||
- name: "Set fact to true if the source file does not exist"
|
||||
set_fact:
|
||||
force_new_ovs_download: True
|
||||
when: ovsdb_server_exists.stat.exists == False
|
||||
|
||||
- debug: msg="Installing OpenVSwitch"
|
||||
when: force_new_ovs_download == True
|
||||
|
||||
- debug: msg="NOT Installing OpenVSwitch, MD5 sum matches"
|
||||
when: force_new_ovs_download == False
|
||||
|
||||
- name: "Copy OVN binaries"
|
||||
copy:
|
||||
src: "{{item}}"
|
||||
dest: "/tmp/{{item}}"
|
||||
with_items:
|
||||
- libopenvswitch_2.13.0-1_amd64.deb
|
||||
- openvswitch-common_2.13.0-1_amd64.deb
|
||||
- openvswitch-switch_2.13.0-1_amd64.deb
|
||||
when: force_new_ovs_download == True
|
||||
|
||||
|
||||
|
||||
|
||||
- name: "Install packages"
|
||||
apt:
|
||||
deb: "{{ item }}"
|
||||
with_items:
|
||||
- "/tmp/libopenvswitch_2.13.0-1_amd64.deb"
|
||||
- "/tmp/openvswitch-common_2.13.0-1_amd64.deb"
|
||||
- "/tmp/openvswitch-switch_2.13.0-1_amd64.deb"
|
||||
when: force_new_ovs_download == True
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
- 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: "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 == True
|
||||
|
||||
#- 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: ovn_nbctl_exists.stat.exists == False
|
||||
|
||||
- debug: msg="Installing OVN"
|
||||
when: force_new_ovn_download == True
|
||||
|
||||
- debug: msg="NOT Installing OVN, MD5 sum matches"
|
||||
when: force_new_ovn_download == False
|
||||
|
||||
- name: "Copy OVN binaries"
|
||||
copy:
|
||||
src: "{{item}}"
|
||||
dest: "/tmp/{{item}}"
|
||||
with_items:
|
||||
- ovn_20.06.0-1_amd64.deb
|
||||
when: force_new_ovn_download == True
|
||||
|
||||
- name: "Install packages"
|
||||
apt:
|
||||
deb: "{{ item }}"
|
||||
with_items:
|
||||
- "/tmp/ovn_20.06.0-1_amd64.deb"
|
||||
when: force_new_ovn_download == True
|
||||
|
||||
|
||||
|
||||
#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
|
51
templates/ovsovn-service-manager.sh.j2
Normal file
51
templates/ovsovn-service-manager.sh.j2
Normal file
@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Illegal number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
echo "ZZZ $1"
|
||||
|
||||
START(){
|
||||
hostname=$(hostname)
|
||||
loopbackIP={{LAN_IP}}
|
||||
controllerIP={{OVN_VIP}}
|
||||
echo "Starting OpenVSwitch and OVN on $hostname with $loopbackIP and pointing to OVN controller $controllerIP"
|
||||
|
||||
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
|
||||
#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 set open . external-ids:ovn-bridge=br-int
|
||||
ovs-vsctl set open . external-ids:ovn-remote=tcp:$controllerIP:6642
|
||||
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"
|
||||
|
||||
{% if ansible_fqdn in groups['compute-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() {
|
||||
echo "Stopping OpenVSwitch and OVN"
|
||||
/usr/share/ovn/scripts/ovn-ctl stop_controller
|
||||
/usr/share/ovn/scripts/ovn-ctl stop_ovsdb
|
||||
/usr/share/openvswitch/scripts/ovs-ctl stop
|
||||
echo "OpenVSwitch and OVN Stopped"
|
||||
}
|
||||
|
||||
case $1 in
|
||||
START|STOP) "$1" ;;
|
||||
esac
|
Loading…
x
Reference in New Issue
Block a user