aboutsummaryrefslogtreecommitdiffstats
path: root/vagrant/playbooks/configure-ovn.yml
blob: 3fd2c765cf78561c047fb11de9278b7f9fd255f4 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2018
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
- hosts: ovn-central:ovn-controller
  become: yes
  tasks:
    - name: Load distribution variables
      include_vars:
        file: "{{ item }}"
      with_items:
        - "{{ ansible_os_family }}.yml"
    - name: get Wand GPI files
      get_url:
        url: https://packages.wand.net.nz/keyring.gpg
        dest: /etc/apt/trusted.gpg.d/wand.gpg
    - name: add WAND Debian Repo
      apt_repository:
        repo: "deb https://packages.wand.net.nz {{ ansible_lsb.codename }} main"
        state: present
    - name: install OpenVSwitch packages
      package:
        name: "{{ item }}"
        state: present
      with_items: "{{ openvswitch_pkgs }}"
    - name: install Open Virtual Network components
      package:
        name: "{{ item }}"
        state: present
      with_items: "{{ ovn_pkgs }}"
    - name: start OpenVSwitch services
      service:
        name: "{{ openvswitch_service }}"
        state: started

- hosts: ovn-central
  become: yes
  tasks:
    - name: Load distribution variables
      include_vars:
        file: "{{ item }}"
      with_items:
        - "{{ ansible_os_family }}.yml"
    - name: install Open Virtual Network central components
      package:
        name: "{{ item }}"
        state: present
      with_items: "{{ ovn_central_pkgs }}"
    - name: enable remote connections to southbound and northbound dbs
      lineinfile:
        path: /etc/default/ovn-central
        line: "OVN_CTL_OPTS=\" --db-sb-create-insecure-remote=yes --db-nb-create-insecure-remote=yes\""
        state: present
      when: ansible_os_family == "Debian"
    - name: start OVN northbound database services
      service:
        name: "{{ ovn_central_service }}"
        state: restarted

- hosts: ovn-controller
  become: yes
  vars:
    ovn_central_ips: "{{ groups['ovn-central'] | map('extract', hostvars, ['ansible_ssh_host']) | join(',') }}"
  tasks:
    - name: Load distribution variables
      include_vars:
        file: "{{ item }}"
      with_items:
        - "{{ ansible_os_family }}.yml"
    - name: stop the ovn-controller service
      service:
        name: "{{ ovn_controller_service }}"
        state: stopped
    - name: configure OpenVSwitch databases
      openvswitch_db:
        table: Open_vSwitch
        record: .
        col: external_ids
        key: ovn-remote
        value: \""tcp:{{ item }}:6642"\"
      with_items: "{{ ovn_central_ips }}"
    - name: enable overlay network protocols
      openvswitch_db:
        table: Open_vSwitch
        record: .
        col: external_ids
        key: ovn-encap-type
        value: geneve
    - name: configure the overlay network local endpoint IP address.
      openvswitch_db:
        table: Open_vSwitch
        record: .
        col: external_ids
        key: ovn-encap-ip
        value: "{{ ansible_default_ipv4.address }}"
    - name: start the ovn-controller service
      service:
        name: "{{ ovn_controller_service }}"
        state: started
    - name: ensuring that br-int bridge exists
      openvswitch_bridge:
        bridge: br-int
        state: present
        fail_mode: secure