summaryrefslogtreecommitdiff
path: root/install-files/openstack/usr/share/openstack/openvswitch.yml
blob: 47257f7fac49fb611c0f6421d4461167156a368f (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
---
- hosts: localhost
  tasks:

  - name: Create openvswitch directories
    file: path={{ item }} state=directory
    with_items:
    - /etc/openvswitch
    - /var/run/openvswitch

  - shell: >
           ovsdb-tool create /etc/openvswitch/conf.db /usr/share/openvswitch/vswitch.ovsschema
           creates=/etc/openvswitch/conf.db

  # We enable the openvswitch-db-server in a different task to identify
  # the first time we run this script by identifying when we enable the
  # unit.
  #
  # We need to identify this to initialise the database.
  - name: Enable openvswitch database service
    service: name={{ item }} enabled=yes
    with_items:
    - openvswitch-db-server.service
    register: openvswitch_db_enable

  - name: Start openvswitch database service
    service: name={{ item }} state=started
    with_items:
    - openvswitch-db-server.service

  - name: initialise openvswitch-db
    shell: ovs-vsctl --no-wait init
    when: openvswitch_db_enable|changed

  - name: Enable and start Open vSwitch service
    service: name={{ item }} enabled=yes state=started
    with_items:
    - openvswitch.service