summaryrefslogtreecommitdiffstats
path: root/scenarios/os-odl-bgpvpn/role/os-odl-bgpvpn/files/openstack-ansible/pike/playbooks/os-setup-bgp-odl.yml
blob: 67a3b2dc0bf058d0c11d9d50d5ca63cb19bdf729 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
# Copyright (c) 2017-2018 Ericsson AB and others.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Install and Configure OpenDaylight for BGPVPN
  hosts: quagga_all
  gather_facts: "{{ osa_gather_facts | default(True) }}"
  user: root

  tasks:
    - name: Retrieve checksum for quagga download
      uri:
        url: "{{ quagga_package_url | replace('tar.gz', 'checksum') }}"
        return_content: yes
      register: quagga_package_checksum

    - name: Attempt quagga download
      get_url:
        url: "{{ quagga_package_url }}"
        dest: "/var/cache/{{ quagga_package_url | basename }}"
        checksum: "sha1:{{ quagga_package_checksum.content | trim }}"
      register: osa_get_quagga

    - name: Unarchive pre-built quagga packages
      unarchive:
        src: "/var/cache/{{ quagga_package_url | basename }}"
        dest: "{{ temp_quagga_dir | dirname }}"
        copy: "no"

    - name: Prerequisite check for quagga
      apt:
        name: libglib2.0-0
        state: present
      when: quagga_install_method == "deb_repo"

    - name: Prerequisite check for quagga
      yum:
        name: glib2,glib2-devel
        state: present
      when: quagga_install_method == "rpm_repo"

    - name: Install quagga rpm packages
      shell: |
        cd {{ temp_quagga_dir }}
        packages=$(ls |grep -vE 'debuginfo|devel|contrib')
        yum -y $packages
      when: quagga_install_method == "rpm_repo"

    - name: Install quagga Debian packages
      shell: |
        cd {{ temp_quagga_dir }}
        packages=$(ls |grep -vE 'debuginfo|devel|contrib')
        dpkg -i $packages
      when: quagga_install_method == "deb_repo"

    - name: Start Zebra RPC Daemon for Quagga
      command: /opt/quagga/etc/init.d/zrpcd start
      when: inventory_hostname == odl_bgp_speaker_host

    - name: Connect OpenDaylight with Quagga
      command: "{{ opendaylight_karaf_client }} -h {{ opendaylight_karaf_host }} 'bgp-connect --host {{ opendaylight_karaf_host }} --port {{ bgp_config_server_port }} add'"
      when: inventory_hostname == odl_bgp_speaker_host

    - name: Configure Opendaylight as BGP speaker
      command: "{{ opendaylight_karaf_client }} -h {{ opendaylight_karaf_host }} 'odl:configure-bgp -op start-bgp-server --as-num 100 --router-id {{ odl_bgp_speaker_host }}'"
      when: inventory_hostname == odl_bgp_speaker_host