Browse Source

Merge "Rewrite deployment of plugin by devstack"

changes/49/589449/18
Zuul 9 months ago
parent
commit
4ee00a9a78
61 changed files with 543 additions and 767 deletions
  1. BIN
      doc/source/installation/deployment_architecture.png
  2. 73
    115
      doc/source/installation/playbooks.rst
  3. 0
    10
      playbooks/contrail.yml
  4. 0
    9
      playbooks/deploy_driver.yml
  5. 0
    11
      playbooks/env.yml
  6. 11
    22
      playbooks/group_vars/all.yml
  7. 3
    4
      playbooks/hosts
  8. 15
    1
      playbooks/main.yml
  9. 0
    11
      playbooks/openstack.yml
  10. 0
    8
      playbooks/prepare.yml
  11. 0
    11
      playbooks/roles/common/defaults/main.yml
  12. 0
    27
      playbooks/roles/common/tasks/check_variables.yml
  13. 0
    33
      playbooks/roles/common/tasks/dependencies.yml
  14. 0
    10
      playbooks/roles/common/tasks/hostname.yml
  15. 0
    9
      playbooks/roles/common/tasks/main.yml
  16. 0
    17
      playbooks/roles/common/tasks/nameserver.yml
  17. 0
    7
      playbooks/roles/common/tasks/ssh_keys.yml
  18. 0
    10
      playbooks/roles/common/tasks/ubuntu_xenial.yml
  19. 0
    4
      playbooks/roles/common/vars/main.yml
  20. 128
    0
      playbooks/roles/contrail_node/tasks/contrail.yml
  21. 3
    0
      playbooks/roles/contrail_node/tasks/main.yml
  22. 19
    0
      playbooks/roles/contrail_node/tasks/update_kernel.yml
  23. 4
    0
      playbooks/roles/contrail_node/templates/hosts.j2
  24. 50
    0
      playbooks/roles/contrail_node/templates/instances.yaml.j2
  25. 0
    10
      playbooks/roles/contrail_vm/files/Analytics-SConscript.patch
  26. 0
    38
      playbooks/roles/contrail_vm/files/contrail_config.patch
  27. 0
    4
      playbooks/roles/contrail_vm/files/contrail_patches
  28. 0
    35
      playbooks/roles/contrail_vm/files/contrail_plugin_diff.patch
  29. 0
    41
      playbooks/roles/contrail_vm/files/plugin.patch
  30. 0
    4
      playbooks/roles/contrail_vm/meta/main.yml
  31. 0
    26
      playbooks/roles/contrail_vm/tasks/contrail_patches.yml
  32. 0
    20
      playbooks/roles/contrail_vm/tasks/dependencies.yml
  33. 0
    30
      playbooks/roles/contrail_vm/tasks/kernel.yml
  34. 0
    7
      playbooks/roles/contrail_vm/tasks/main.yml
  35. 0
    18
      playbooks/roles/contrail_vm/tasks/stack_sh.yml
  36. 41
    0
      playbooks/roles/devstack_compute_node/tasks/main.yml
  37. 36
    0
      playbooks/roles/devstack_compute_node/templates/compute_local.conf.j2
  38. 5
    7
      playbooks/roles/devstack_controller_node/tasks/main.yml
  39. 54
    0
      playbooks/roles/devstack_controller_node/templates/controller_local.conf.j2
  40. 0
    11
      playbooks/roles/fetch_devstack/defaults/main.yml
  41. 0
    3
      playbooks/roles/fetch_devstack/meta/main.yml
  42. 0
    4
      playbooks/roles/fetch_devstack/tasks/main.yml
  43. 0
    47
      playbooks/roles/fetch_devstack/templates/contrail_local.conf.j2
  44. 0
    35
      playbooks/roles/fetch_devstack/templates/openstack_local.conf.j2
  45. BIN
      playbooks/roles/networking_bgpvpn_plugin/files/cfgm_common-0.1.dev0.tar.gz
  46. BIN
      playbooks/roles/networking_bgpvpn_plugin/files/vnc_api-5.0.0.tar.gz
  47. 75
    0
      playbooks/roles/networking_bgpvpn_plugin/tasks/main.yml
  48. 0
    11
      playbooks/roles/openstack_vm/files/keystone.patch
  49. 0
    10
      playbooks/roles/openstack_vm/files/keystone_stable-pike.patch
  50. 0
    5
      playbooks/roles/openstack_vm/meta/main.yml
  51. 0
    8
      playbooks/roles/openstack_vm/tasks/main.yml
  52. 0
    14
      playbooks/roles/openstack_vm/tasks/openstack_patch.yml
  53. 0
    12
      playbooks/roles/openstack_vm/tasks/stack_sh.yml
  54. 15
    0
      playbooks/roles/restack_compute_node/tasks/main.yml
  55. 0
    5
      playbooks/roles/restack_contrail/tasks/main.yml
  56. 0
    10
      playbooks/roles/restack_contrail/tasks/services.yml
  57. 0
    14
      playbooks/roles/restack_contrail/tasks/stack_sh.yml
  58. 0
    5
      playbooks/roles/restack_contrail/tasks/unstack_sh.yml
  59. 11
    0
      playbooks/roles/restack_controller_node/tasks/main.yml
  60. 0
    3
      playbooks/roles/source_openrc/tasks/main.yml
  61. 0
    11
      playbooks/roles/source_openrc/tasks/source_openrc.yml

BIN
doc/source/installation/deployment_architecture.png View File


+ 73
- 115
doc/source/installation/playbooks.rst View File

@@ -3,9 +3,18 @@ Setup development VMs
3 3
 =====================
4 4
 
5 5
 Playbooks are designed to setup two nodes. The first node
6
-contains Openstack with, among others, keystone, neutron
7
-and neutron-opencontrail plugin as ML2 L3 driver.
8
-Second node contains nightly-build contrail node.
6
+contains Openstack with, keystone, neutron, horizon, etc.
7
+It has also neutron-opencontrail plugin as neutron ML2 L3 driver.
8
+Second node contains nightly-build contrail node with simple devstack as compute node.
9
+
10
+Playbooks deploy Openstack in stable/ocata version and OpenContrail in one of the latest nightly build.
11
+
12
+Overview of deployment architecture:
13
+
14
+.. image:: deployment_architecture.png
15
+    :width: 600px
16
+    :align: center
17
+    :alt: Diagram of deployment architecture
9 18
 
10 19
 Step by step instruction is presented below.
11 20
 
@@ -20,13 +29,13 @@ Before you run playbooks perform the following steps:
20 29
 
21 30
 Let's assume there are two hosts:
22 31
 
23
-+-----------+--------------+----------------+--------------+------------------------------------+
24
-| Node      | OS           | Public IP      | Internal IP  | Notes                              |
25
-+===========+==============+================+==============+====================================+
26
-| openstack | Ubuntu 16.04 | 10.100.0.3     | 192.168.0.3  | setup by playbooks                 |
27
-+-----------+--------------+----------------+--------------+------------------------------------+
28
-| contrail  | CentOS 7.4   | 10.100.0.2     | 192.168.0.2  | setup by contrail-ansible-deployer |
29
-+-----------+--------------+----------------+--------------+------------------------------------+
32
++-----------+--------------+--------------------------+------------+-------------+----------------------------------------+
33
+| Node      | OS           | Recommended requirements | Public IP  | Internal IP | Notes                                  |
34
++===========+==============+==========================+============+=============+========================================+
35
+| openstack | Ubuntu 16.04 | RAM: 8 GB                | 10.100.0.3 | 192.168.0.3 | devstack (controller node)             |
36
++-----------+--------------+--------------------------+------------+-------------+----------------------------------------+
37
+| contrail  | CentOS 7.4   | RAM: 16 GB               | 10.100.0.2 | 192.168.0.2 | opencontrail + devstack (compute node) |
38
++-----------+--------------+--------------------------+------------+-------------+----------------------------------------+
30 39
 
31 40
 **2. Make sure you have key-based SSH access to prepared nodes**
32 41
 
@@ -54,159 +63,108 @@ Configuration require editing few files before running any playbook.
54 63
 
55 64
 **1. Define nodes by specifying SSH names or IP of machines in ``playbooks/hosts``**
56 65
 
57
-.. code-block:: console
58
-
59
-    $ vim playbooks/hosts
60
-
61 66
 Change ``contrail-node`` and ``openstack-node`` to public IP of your machines.
62 67
 
63 68
 .. code-block:: text
64 69
 
65
-    [contrail]
66
-    10.100.0.2
70
+    controller ansible_host=10.100.0.3 ansible_user=ubuntu
67 71
 
68
-    [openstack]
69
-    10.100.0.3
72
+    [compute]
73
+    10.100.0.2 ansible_user=centos
70 74
 
71
-**2. Change deployment variables in ``playbooks/group_vars/all.yml``**
72 75
 
73
-.. code-block:: console
76
+Optionally, you can add a username to this config, if you ssh to machine with username: ``10.100.0.2 ansible_user=centos``
74 77
 
75
-    $ vim playbooks/group_vars/all.yml
78
+**2. Change deployment variables in ``playbooks/group_vars/all.yml``**
76 79
 
77 80
 ``contrail_ip`` and ``openstack_ip`` should be internal IP addresses.
81
+``contrail_gateway`` should be gateway address of the contrail_ip.
82
+``contrail_interface`` should be interface name that has bound contrail ip.
78 83
 
79 84
 ``openstack_branch`` should be set to ``stable/ocata``
80
-``contrail_branch`` is currently ignored but it must not be empty.
81
-
82
-Example config:
85
+``install_networking_bgpvpn_plugin`` is a boolean value. If set true, it will install the neutron_bgpvpn plugin.
83 86
 
84 87
 .. code-block:: yaml
85 88
 
86
-    # [Required] IP address for OpenConrail VM.
89
+    # IP address for OpenConrail.
87 90
     contrail_ip: 192.168.0.2
88
-    # [Required] IP address for Openstack VM.
89
-    openstack_ip: 192.168.0.3
90
-
91
-    # [Required] Openstack branch used on VMs.
92
-    openstack_branch: stable/ocata
93
-    # [Required] OpenContrail branch to build on VM.
94
-    contrail_branch: R4.1
95
-
96
-    # [Required] Kernel version supported by OpenContrail branch.
97
-    kernel_version: 4.4.0-112
98
-
99
-**3. Enable networking-opencontrail plugin**
100
-
101
-Update ``openstack_local.conf.j2`` template.
102
-
103
-.. code-block:: console
104
-
105
-    $ vim playbooks/roles/fetch_devstack/templates/openstack_local.conf.j2
106 91
 
107
-.. warning:: If plugin is already defined,
108
-             make sure URL and branch version is correct.
92
+    # Gateway address for OpenConrail.
93
+    contrail_gateway: 192.168.0.1
109 94
 
110
-At the end of file add new line with ``enable_plugin`` directive.
95
+    # Interface name for OpenConrail.
96
+    contrail_interface: eth0
111 97
 
112
-.. code-block:: text
113 98
 
114
-    enable_plugin networking-opencontrail https://github.com/openstack/networking-opencontrail stable/ocata
99
+    # IP address for Openstack VM.
100
+    openstack_ip: 192.168.0.3
115 101
 
116
-.. note:: Plugin branch should be the same as OpenStack.
117
-          For example if openstack_branch is ``stable/ocata``
118
-          plugin also should point to ``stable/ocata`` branch.
102
+    # Openstack branch used on VMs.
103
+    openstack_branch: stable/ocata
119 104
 
105
+    # If true, then install networking_bgpvpn plugin with contrail driver
106
+    install_networking_bgpvpn_plugin: false
120 107
 
121 108
 **********
122 109
 Deployment
123 110
 **********
124 111
 
125
-Openstack node
126
-==============
112
+Run playbooks
113
+=============
127 114
 
128
-.. note:: Before openstack deployment make sure Playbooks are configured.
115
+.. note:: Before openstack deployment make sure playbooks are configured.
129 116
 
130 117
 Execute ``playbooks/main.yml`` file.
131
-Make sure you are in playbooks directory before executing playbook.
118
+Make sure you are in playbooks directory before executing the playbooks.
132 119
 This will make Ansible to use local ``hosts`` file instead of system broad defined hosts.
133 120
 
134 121
 .. code-block:: console
135 122
 
136 123
     $ cd playbooks
137
-    $ ./main.yml  --limit openstack
138
-
124
+    $ ./main.yml
139 125
 
140
-Contrail node
141
-=============
126
+This playbooks can last 1 hour or more.
142 127
 
143
-**1. Clone Contrail Ansible Deployer from Github**
128
+Please be patient while executing roles with ``stack.sh``. Real time logs from these operations can be viewed on each host by following command:
129
+``less -R /opt/stack/logs/stack.sh.log``
144 130
 
145
-.. code-block:: console
131
+*****
132
+Usage
133
+*****
146 134
 
147
-    $ git clone http://github.com/Juniper/contrail-ansible-deployer
135
+Access web interface
136
+====================
148 137
 
149
-**2. Define contrail node by specifying SSH name or IP of machine in ``inventory/hosts``**
138
+* http://10.100.0.3/ - devstack's horizon. Credentials: admin/admin
150 139
 
151
-.. warning:: If file is not empty. Remove everything and start from scratch.
140
+* https://10.100.0.2:8143/ - OpenContrail UI. Credentials: admin/admin (domain can be empty or "default")
152 141
 
153
-Edit hosts file
142
+Create example VM
143
+=================
154 144
 
155
-.. code-block:: console
145
+After successful deployment, it could be possible to create sample Virtual Machine.
146
+It is important to create new security group, because the default is not synchronized correctly between contrail and devstack.
156 147
 
157
-    $ vim inventory/hosts
158
-
159
-Copy and paste snippet at the end of the file and change IP to Contrail machine public IP
160
-
161
-.. code-block:: text
162
-
163
-    container_hosts:
164
-      hosts:
165
-        10.100.0.2:
166
-          ansible_user: centos
167
-
168
-**3. Contrail nightly builds variables**
169
-
170
-Currently, nightly-builds are available in docker hub's opencontrailnightly repo.
171
-At https://hub.docker.com/r/opencontrailnightly/contrail-agent-vrouter/tags/
172
-can be viewed available contrail builds.
173
-
174
-* ``CONTRAIL_VERSION``: container tag for example ``latest``
175
-* ``CONTROLLER_NODES``: internal IP of contrail node
176
-* ``KEYSTONE_AUTH_HOST``: internal IP of openstack node
177
-* roles ``<IP>``: public IP of contrail node
178
-
179
-Edit inventory variables:
148
+These commands should be ran on one of the nodes (both are connected to one neutron).
149
+Assuming that contrail node has ``contrail-node.novalocal`` hostname (used in availability zone):
180 150
 
181 151
 .. code-block:: console
182 152
 
183
-    $ vim config/instances.yaml
184
-
185
-Example config:
153
+    source ~/devstack/openrc admin demo
154
+    openstack network create --provider-network-type vlan --provider-segment 3 --provider-physical-network vhost net
155
+    openstack subnet create --network net --subnet-range 192.168.1.0/24 --dhcp subnet
156
+    openstack security group create secgroup
157
+    openstack security group rule create --ingress --protocol icmp secgroup
158
+    openstack security group rule create --ingress --protocol tcp secgroup
159
+    openstack server create  --flavor cirros256 --image cirros-0.3.4-x86_64-uec --nic net-id=net --security-group secgroup \
160
+      --availability-zone nova:contrail-node.novalocal instance
186 161
 
187
-.. code-block:: yaml
162
+Created VM could be accessed by VNC (through horizon):
188 163
 
189
-    provider_config:
190
-      bms:
191
-    instances:
192
-      bms1:
193
-        provider: bms
194
-        ip: 10.100.0.2
195
-    contrail_configuration:
196
-      CONTAINER_REGISTRY: opencontrailnightly
197
-      CONTRAIL_VERSION: latest
198
-      CONTROLLER_NODES: 192.168.0.2  # contrail node internal IP
199
-      CLOUD_ORCHESTRATOR: openstack
200
-      AUTH_MODE: keystone
201
-      KEYSTONE_AUTH_ADMIN_PASSWORD: admin
202
-      KEYSTONE_AUTH_HOST: 192.168.0.3  # openstack node internal IP
203
-      RABBITMQ_NODE_PORT: 5673
204
-      PHYSICAL_INTERFACE: eth1
205
-      VROUTER_GATEWAY: 192.168.0.1
206
-
207
-**4. Run ansible playbook**
164
+1. Go to horizon's list of VMs http://10.100.0.3/dashboard/project/instances/
208 165
 
209
-.. code-block:: console
166
+2. Enter into the VM's console.
167
+  - If the console does not response, click the link "Click here to show only console".
168
+  - If you see black console, press enter to attach.
210 169
 
211
-    $ ansible-playbook -i inventory/ playbooks/configure_instances.yml
212
-    $ ansible-playbook -i inventory/ -e orchestrator=openstack playbooks/install_contrail.yml
170
+3. Login into. Default login/password is ``cirros/cubswin:)``

+ 0
- 10
playbooks/contrail.yml View File

@@ -1,10 +0,0 @@
1
----
2
-# Install Contrail (with use of devstack), do not enable any services yet
3
-
4
-- hosts: contrail
5
-  gather_facts: no 
6
-  become: no
7
-  roles:
8
-    - { role: fetch_devstack, vm_group: contrail }
9
-    - { role: contrail_vm }
10
-

+ 0
- 9
playbooks/deploy_driver.yml View File

@@ -1,9 +0,0 @@
1
----
2
-
3
-- hosts: contrail
4
-  gather_facts: no 
5
-  become: no
6
-  roles:
7
-    - { role: restack_contrail }
8
-    - { role: source_openrc }
9
-

+ 0
- 11
playbooks/env.yml View File

@@ -1,11 +0,0 @@
1
----
2
-# Deploy two-node environment: Contrail node and OpenStack node
3
-
4
-- include: prepare.yml
5
-
6
-- include: contrail.yml
7
-
8
-- include: openstack.yml
9
-
10
-- include: deploy_driver.yml
11
-

+ 11
- 22
playbooks/group_vars/all.yml View File

@@ -1,30 +1,19 @@
1 1
 ---
2
-# Note: Unused variables should be commented!
2
+# IP address for OpenConrail (e.g. 192.168.0.2)
3
+contrail_ip:
3 4
 
4
-# [Optional] Multihost installation with compute node and OpenStack controller on different VMs. Default value True.
5
-#multihost: True
5
+# Gateway address for OpenConrail (e.g. 192.168.0.1)
6
+contrail_gateway:
6 7
 
7
-# [Optional] Do not create initial project networks by Neutron. Default value False.
8
-#create_initial_networks: False
8
+# Interface name for OpenConrail (e.g. eth0)
9
+contrail_interface:
9 10
 
10
-# [Optional] If service_token not specified default 'token' will be used.
11
-#service_token:
12
-# [Optional] If password not specified default 'admin' will be used.
13
-#admin_pass:
14 11
 
15
-# [Required] IP address for OpenConrail VM.
16
-contrail_ip:
17
-# [Required] IP address for Openstack VM.
12
+# IP address for Openstack VM (e.g. 192.168.0.3)
18 13
 openstack_ip:
19 14
 
20
-# [Optional] If not specified default value 8082 will be used.
21
-#contrail_port: 8082
22
-
23
-# [Required] Openstack branch used on VMs.
24
-openstack_branch:
25
-# [Required] OpenContrail branch to build on VM.
26
-contrail_branch:
15
+# Openstack branch used on VMs.
16
+openstack_branch: stable/ocata
27 17
 
28
-# [Required] Kernel version supported by OpenContrail branch. This must be a part of package name 
29
-# for example to use ubuntu 14.0.4 linux-image-3.13.0-77-generic package you should enter 3.13.0-77 here
30
-kernel_version:
18
+# If true, then install networking_bgpvpn plugin with contrail driver
19
+install_networking_bgpvpn_plugin: false

+ 3
- 4
playbooks/hosts View File

@@ -1,5 +1,4 @@
1
-[contrail]
2
-contrail-node
1
+controller ansible_host=openstack-node ansible_user=ubuntu
3 2
 
4
-[openstack]
5
-openstack-node
3
+[compute]
4
+contrail-node ansible_user=centos

+ 15
- 1
playbooks/main.yml View File

@@ -1,3 +1,17 @@
1 1
 #!/usr/bin/env ansible-playbook
2 2
 
3
-- include: env.yml
3
+- hosts: controller
4
+  roles:
5
+    - devstack_controller_node
6
+    - restack_controller_node
7
+- hosts: compute
8
+  roles:
9
+    - contrail_node
10
+- hosts: controller
11
+  roles:
12
+    - { role: networking_bgpvpn_plugin, when: install_networking_bgpvpn_plugin }
13
+    - { role: restack_controller_node, when: install_networking_bgpvpn_plugin }
14
+- hosts: compute
15
+  roles:
16
+    - devstack_compute_node
17
+    - restack_compute_node

+ 0
- 11
playbooks/openstack.yml View File

@@ -1,11 +0,0 @@
1
----
2
-# Install OpenStack (via devstack)
3
-
4
-- hosts: openstack 
5
-  gather_facts: no 
6
-  become: no
7
-  roles:
8
-    - { role: fetch_devstack, vm_group: openstack }
9
-    - { role: openstack_vm }
10
-    - { role: source_openrc }
11
-

+ 0
- 8
playbooks/prepare.yml View File

@@ -1,8 +0,0 @@
1
----
2
-# One time hosts preparation
3
-
4
-- hosts: contrail openstack
5
-  gather_facts: yes
6
-  become: no
7
-  roles:
8
-    - { role: common }

+ 0
- 11
playbooks/roles/common/defaults/main.yml View File

@@ -1,11 +0,0 @@
1
----
2
-# default nameserver
3
-nameserver: 8.8.8.8
4
-
5
-# default variables values for VMs
6
-multihost: True
7
-create_initial_networks: False
8
-service_token: token
9
-admin_pass: admin
10
-# default OpenContrail API port number
11
-contrail_port: 8082

+ 0
- 27
playbooks/roles/common/tasks/check_variables.yml View File

@@ -1,27 +0,0 @@
1
----
2
-# check for not specified variables from group_vars/all.yml
3
-
4
-- fail:
5
-    msg: "contrail_ip: Please check group_vars/all.yml if all required vars were set."
6
-  when: not contrail_ip | ipv4 
7
-  tags: check
8
-
9
-- fail:
10
-    msg: "openstack_ip: Please check group_vars/all.yml if all required vars were set."
11
-  when: not openstack_ip | ipv4
12
-  tags: check
13
-
14
-- fail:
15
-    msg: "openstack_branch: Please check group_vars/all.yml if all required vars were set."
16
-  when: not openstack_branch | mandatory
17
-  tags: check
18
-
19
-- fail:
20
-    msg: "contrail_branch: Please check group_vars/all.yml if all required vars were set."
21
-  when: not contrail_branch | mandatory
22
-  tags: check
23
-
24
-- fail:
25
-    msg: "kernel_version: Please check group_vars/all.yml if all required vars were set."
26
-  when: not kernel_version | mandatory
27
-  tags: check

+ 0
- 33
playbooks/roles/common/tasks/dependencies.yml View File

@@ -1,33 +0,0 @@
1
----
2
-# install required dependencies 
3
-- name: install python-apt
4
-  command: apt install {{ item }} -y 
5
-  with_items:
6
-    - "python-apt"
7
-    - "libsasl2-dev"
8
-  become: yes
9
-
10
-- name: install git, pip, setuptools & python-dev
11
-  apt:
12
-    name: "{{ item }}"
13
-    update_cache: yes
14
-    cache_valid_time: 3600
15
-  with_items:
16
-    - "git"
17
-    - "python-setuptools"
18
-    - "python-pip"
19
-    - "python-dev"
20
-  become: yes
21
-
22
-- name: (hack) install devstack dependencies those will be replaced later with devstack requirements.txt
23
-  pip: 
24
-    name: "{{ item }}"
25
-  become: yes
26
-  with_items:
27
-    - 'pytz'
28
-    - 'iso8601'
29
-    - 'cmd2'
30
-    - 'netifaces'
31
-    - 'monotonic'
32
-    - 'wrapt'
33
-    - 'rfc3986'

+ 0
- 10
playbooks/roles/common/tasks/hostname.yml View File

@@ -1,10 +0,0 @@
1
----
2
-# Add hostname to /etc/hosts
3
-
4
-- name: adding hostname to /etc/hosts
5
-  lineinfile:
6
-    dest: /etc/hosts
7
-    regexp: '^127\.0\.1\.1'
8
-    line: '127.0.1.1 {{ ansible_hostname }}'
9
-    state: present
10
-  become: yes

+ 0
- 9
playbooks/roles/common/tasks/main.yml View File

@@ -1,9 +0,0 @@
1
----
2
-# Playbook initialize VM for further installation steps
3
-
4
-- include: hostname.yml
5
-- include: check_variables.yml
6
-- include: ubuntu_xenial.yml
7
-- include: ssh_keys.yml
8
-- include: nameserver.yml
9
-- include: dependencies.yml

+ 0
- 17
playbooks/roles/common/tasks/nameserver.yml View File

@@ -1,17 +0,0 @@
1
----
2
-# configure nameserver in VM
3
-- name: configure nameserver
4
-  lineinfile:
5
-    dest: /etc/dhcp/dhclient.conf
6
-    insertafter: '^#prepend domain-name-servers' 
7
-    line: 'supersede domain-name-servers {{ nameserver }};'
8
-    state: present
9
-  become: yes
10
-
11
-- name: update resolv.conf 
12
-  lineinfile:
13
-    dest: /etc/resolv.conf
14
-    regexp: '^nameserver .*'
15
-    line: 'nameserver {{ nameserver }}'
16
-    state: present
17
-  become: yes

+ 0
- 7
playbooks/roles/common/tasks/ssh_keys.yml View File

@@ -1,7 +0,0 @@
1
----
2
-# install ssh keys on VM 
3
-- name: install ssh key on VM
4
-  authorized_key: user=ubuntu 
5
-                  key={{ lookup('file', '~/.ssh/id_rsa.pub') }} 
6
-                  state=present
7
-  become: no

+ 0
- 10
playbooks/roles/common/tasks/ubuntu_xenial.yml View File

@@ -1,10 +0,0 @@
1
----
2
-# install prerequisite for xenial
3
-
4
-- name: setup nameserver before installing python
5
-  raw: 'sed -i_bak "s/\(nameserver\) .*/\1 8\.8\.8\.8/" /etc/resolv.conf'
6
-  become: yes
7
-
8
-- name: install python 2.7 required by ansible 
9
-  raw: 'apt-get update && apt install -y python'
10
-  become: yes

+ 0
- 4
playbooks/roles/common/vars/main.yml View File

@@ -1,4 +0,0 @@
1
----
2
-# override default nameserver
3
-
4
-# nameserver: 8.8.8.8

+ 128
- 0
playbooks/roles/contrail_node/tasks/contrail.yml View File

@@ -0,0 +1,128 @@
1
+---
2
+- name: Install required utilities
3
+  become: yes
4
+  yum:
5
+    name: "{{ item }}"
6
+    state: present
7
+  with_items:
8
+      - python-devel
9
+      - epel-release
10
+      - gcc
11
+      - git
12
+      - ansible-2.4.*
13
+      - yum-utils
14
+
15
+- name: Install pip
16
+  become: yes
17
+  yum:
18
+    name: python-pip
19
+    state: present
20
+
21
+- name: Add docker-ce repository
22
+  become: yes
23
+  shell: |
24
+    yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
25
+
26
+- name: Install docker
27
+  become: yes
28
+  yum:
29
+    name: docker-ce
30
+    state: present
31
+
32
+- name: Start docker daemon
33
+  become: yes
34
+  service:
35
+    name: docker
36
+    state: running
37
+    enabled: yes
38
+
39
+- name: Add user to docker group
40
+  become: yes
41
+  user:
42
+    name: centos
43
+    groups: docker
44
+    append: yes
45
+
46
+- name: install docker and docker-compose for python
47
+  pip:
48
+    name: "{{ item }}"
49
+    state: present
50
+    extra_args: --user
51
+  with_items:
52
+    - docker-py==1.10.6
53
+    - docker-compose==1.9.0
54
+
55
+# Dirty ugly workaround on contrail-ansible-deployer not using 'become' in playbooks
56
+- name: Create directories for contrail
57
+  shell: |
58
+    set -e
59
+    set -x
60
+    sudo mkdir -p /var/log/contrail
61
+    sudo mkdir -p /etc/contrail
62
+    sudo chmod 777 /var/log/contrail /etc/contrail
63
+
64
+# Contrail Ansible Deployer
65
+- name: Create ssh key and add to authorized_key for centos user
66
+  shell: |
67
+    set -e
68
+    set -x
69
+    yes | ssh-keygen -t rsa -N '' -f ~/.ssh/centos_rsa
70
+    cat ~/.ssh/centos_rsa.pub | tee --append ~/.ssh/authorized_keys
71
+    chmod 700 ~/.ssh
72
+    chmod 600 ~/.ssh/centos_rsa ~/.ssh/authorized_keys
73
+
74
+- name: Clone 'contrail-ansible-deployer' repository
75
+  git:
76
+    clone: yes
77
+    force: yes
78
+    dest: ~/contrail-ansible-deployer
79
+    repo: https://github.com/Juniper/contrail-ansible-deployer.git
80
+
81
+- name: Checkout 'contrail-ansible-deployer' repository
82
+  shell: |
83
+    cd ~/contrail-ansible-deployer
84
+    git checkout 38a0b84ec7a5f4c2a1b8b8c9c36b007dc8477b1f
85
+
86
+- name: Update hosts file
87
+  template:
88
+    src: hosts.j2
89
+    dest: ~/contrail-ansible-deployer/inventory/hosts
90
+
91
+- name: Update instances.yaml file
92
+  template:
93
+    src: instances.yaml.j2
94
+    dest: ~/contrail-ansible-deployer/config/instances.yaml
95
+
96
+- name: Provision Node before deploy contrail
97
+  shell: |
98
+    set -e
99
+    set -x
100
+    cd ~/contrail-ansible-deployer/
101
+    ansible-playbook -vv \
102
+                     -e skip_openstack=true \
103
+                     -e config_file=~/contrail-ansible-deployer/config/instances.yaml \
104
+                     -i inventory/ playbooks/configure_instances.yml
105
+
106
+- name: Deploy OpenContrail
107
+  shell: |
108
+    set -e
109
+    set -x
110
+    cd ~/contrail-ansible-deployer/
111
+    ansible-playbook -vv \
112
+                     -e skip_openstack=true \
113
+                     -e config_file=~/contrail-ansible-deployer/config/instances.yaml \
114
+                     -e '{"CREATE_CONTAINERS":true}' \
115
+                     -e orchestrator=none \
116
+                     -i inventory/ playbooks/install_contrail.yml
117
+
118
+- name: Wait for contrail until fully running
119
+  wait_for:
120
+    sleep: 5
121
+    host: "{{ contrail_ip }}"
122
+    port: 8082
123
+    timeout: 300
124
+
125
+- name: Copy vrouter
126
+  become: yes
127
+  shell: |
128
+    docker cp vrouter_vrouter-agent_1:/usr/bin/vrouter-port-control /usr/bin/

+ 3
- 0
playbooks/roles/contrail_node/tasks/main.yml View File

@@ -0,0 +1,3 @@
1
+---
2
+- include: update_kernel.yml
3
+- include: contrail.yml

+ 19
- 0
playbooks/roles/contrail_node/tasks/update_kernel.yml View File

@@ -0,0 +1,19 @@
1
+---
2
+- name: update kernel
3
+  become: yes
4
+  yum:
5
+    name: kernel
6
+    state: latest
7
+  register: update_kernel
8
+
9
+- name: Reboot the machine
10
+  become: yes
11
+  shell: nohup bash -c "sleep 2s && shutdown -r now" &
12
+  when: update_kernel.changed
13
+  register: reboot_machine
14
+
15
+- name: Wait for machine to come back
16
+  wait_for_connection:
17
+    timeout: 240
18
+    delay: 10
19
+  when: reboot_machine.changed

+ 4
- 0
playbooks/roles/contrail_node/templates/hosts.j2 View File

@@ -0,0 +1,4 @@
1
+container_hosts:
2
+  hosts:
3
+    {{ contrail_ip }}:
4
+      ansible_user: centos

+ 50
- 0
playbooks/roles/contrail_node/templates/instances.yaml.j2 View File

@@ -0,0 +1,50 @@
1
+provider_config:
2
+  bms:
3
+    ssh_user: centos
4
+    ssh_public_key: ~/.ssh/centos_rsa.pub
5
+    ssh_private_key: ~/.ssh/centos_rsa
6
+    ntpserver: 0.pool.ntp.org
7
+    nameserer: 8.8.8.8
8
+
9
+instances:
10
+  bms1:
11
+    provider: bms
12
+    ip: {{ contrail_ip }}
13
+    roles:
14
+      config_database:
15
+      config:
16
+      control:
17
+      webui:
18
+      vrouter:
19
+      openstack:
20
+      openstack_compute:
21
+
22
+global_configuration:
23
+  CONTAINER_REGISTRY: opencontrailnightly
24
+
25
+contrail_configuration:
26
+  CONTRAIL_VERSION: ocata-master-105
27
+  CLOUD_ORCHESTRATOR: None
28
+  LOG_LEVEL: SYS_DEBUG
29
+  AAA_MODE: no-auth
30
+  VROUTER_GATEWAY: {{ contrail_gateway }}
31
+  PHYSICAL_INTERFACE: {{ contrail_interface }}
32
+  AUTH_MODE: keystone
33
+  KEYSTONE_AUTH_ADMIN_PASSWORD: admin
34
+  KEYSTONE_AUTH_HOST: {{ openstack_ip }}
35
+  KEYSTONE_AUTH_URL_VERSION: /identity/v3
36
+  KEYSTONE_AUTH_URL_TOKENS: /identity/v3/auth/tokens
37
+  KEYSTONE_AUTH_INSECURE: true
38
+  KEYSTONE_AUTH_ADMIN_PORT: 80
39
+  KEYSTONE_AUTH_PUBLIC_PORT: 80
40
+  RABBITMQ_NODE_PORT: 5673
41
+  UPDATE_IMAGES: true
42
+  UPGRADE_KERNEL: true
43
+  CONTROLLER_NODES: {{ contrail_ip }}
44
+  CONTROL_NODES: {{ contrail_ip }}
45
+  WEBUI_NODES: {{ contrail_ip }}
46
+  CONFIGDB_NODES: {{ contrail_ip }}
47
+  CONFIG_NODES: {{ contrail_ip }}
48
+  CONFIG_NODEMGR__DEFAULTS__minimum_diskGB: 2
49
+  DATABASE_NODEMGR__DEFAULTS__minimum_diskGB: 2
50
+  JVM_EXTRA_OPTS: "-Xms1g -Xmx2g"

+ 0
- 10
playbooks/roles/contrail_vm/files/Analytics-SConscript.patch View File

@@ -1,10 +0,0 @@
1
---- controller/src/analytics/SConscript-orig	2017-08-22 14:24:31.000000000 +0000
2
-+++ controller/src/analytics/SConscript	2017-08-28 13:50:22.405913015 +0000
3
-@@ -58,6 +58,7 @@
4
-         'zookeeper_client',
5
-         'zookeeper_mt',
6
-         'ssl',
7
-+	'sasl2',
8
-         'crypto',
9
-         'boost_filesystem',
10
-         'boost_program_options',

+ 0
- 38
playbooks/roles/contrail_vm/files/contrail_config.patch View File

@@ -1,38 +0,0 @@
1
---- /opt/stack/contrail/devstack/lib/contrail_config	2017-07-27 09:12:11.603603000 +0000
2
-+++ /home/ubuntu/contrail_plugin_zioc/contrail_config.new	2017-07-28 07:25:46.151703981 +0000
3
-@@ -340,6 +340,35 @@
4
-     iniset -sudo $config_file DEFAULT log_local 1
5
- }
6
- 
7
-+function contrail_config_alarm_gen()
8
-+{
9
-+    local config_file="/etc/contrail/contrail-alarm-gen.conf"
10
-+    sudo truncate -s 0 $config_file
11
-+
12
-+    [[ -n $CLUSTER_ID ]] && iniset -sudo $config_file DATABASE cluster_id $CLUSTER_ID
13
-+
14
-+    iniset -sudo $config_file DEFAULT host_ip $COLLECTOR_IP
15
-+
16
-+    #REVISIT: analytics api currently fails with default value (15)
17
-+    iniset -sudo $config_file DEFAULT partitions 0
18
-+
19
-+    if _vercmp $CONTRAIL_BRANCH "<" R3.0; then
20
-+        iniset -sudo $config_file DEFAULT cassandra_server_list "$CASSANDRA_IP_PORT_LIST"
21
-+    else
22
-+        iniset -sudo $config_file DEFAULT cassandra_server_list "$CASSANDRA_CQL_IP_PORT_LIST"
23
-+    fi
24
-+
25
-+    if _vercmp $CONTRAIL_BRANCH "<" R4.0; then
26
-+        iniset -sudo $config_file DISCOVERY disc_server_ip $DISCOVERY_IP
27
-+        iniset -sudo $config_file DISCOVERY disc_server_port 5998
28
-+    else
29
-+        iniset -sudo $config_file DEFAULT collectors "$COLLECTOR_IP_PORT_LIST"
30
-+    fi
31
-+
32
-+    iniset -sudo $config_file DEFAULT log_level 'SYS_DEBUG'
33
-+    iniset -sudo $config_file DEFAULT log_local 1
34
-+}
35
-+
36
- function contrail_config_query()
37
- {
38
-     local config_file="/etc/contrail/contrail-query-engine.conf"

+ 0
- 4
playbooks/roles/contrail_vm/files/contrail_patches View File

@@ -1,4 +0,0 @@
1
-patch $CONTRAIL_DEST/devstack/plugin.sh < plugin.patch
2
-patch $CONTRAIL_DEST/devstack/plugin.sh < contrail_plugin_diff.patch
3
-patch $CONTRAIL_DEST/devstack/lib/contrail_config < contrail_config.patch
4
-patch $CONTRAIL_DEST/controller/src/analytics/SConscript < Analytics-SConscript.patch

+ 0
- 35
playbooks/roles/contrail_vm/files/contrail_plugin_diff.patch View File

@@ -1,35 +0,0 @@
1
---- /opt/stack/contrail/devstack/plugin.sh.orig	2018-01-12 11:52:36.534751974 +0000
2
-+++ /opt/stack/contrail/devstack/plugin.sh	2018-01-12 12:15:53.605687810 +0000
3
-@@ -166,21 +166,21 @@
4
-     [ ! -d /var/log/contrail ] && sudo mkdir /var/log/contrail
5
-     sudo chmod 777 /var/log/contrail
6
-
7
--    run_process vrouter "sudo contrail-vrouter-agent --config_file=/etc/contrail/contrail-vrouter-agent.conf"
8
--    run_process api-srv "contrail-api --conf_file /etc/contrail/contrail-api.conf"
9
-+    run_process vrouter "/usr/bin/contrail-vrouter-agent --config_file=/etc/contrail/contrail-vrouter-agent.conf" ubuntu root
10
-+    run_process api-srv "/usr/bin/contrail-api --conf_file /etc/contrail/contrail-api.conf"
11
-     # Wait for api to be ready, as it creates cassandra CF required for disco to start
12
-     is_service_enabled disco && is_service_enabled api-srv && wget --no-proxy --retry-connrefused --no-check-certificate --waitretry=1 -t 60 -q -O /dev/null http://$APISERVER_IP:8082 || true
13
--    run_process disco "contrail-discovery --conf_file /etc/contrail/contrail-discovery.conf"
14
--    run_process svc-mon "contrail-svc-monitor --conf_file /etc/contrail/contrail-svc-monitor.conf"
15
--    run_process schema "contrail-schema --conf_file /etc/contrail/contrail-schema.conf"
16
--    run_process control "sudo contrail-control --conf_file /etc/contrail/contrail-control.conf"
17
--    run_process collector "contrail-collector --conf_file /etc/contrail/contrail-collector.conf"
18
--    run_process analytic-api "contrail-analytics-api --conf_file /etc/contrail/contrail-analytics-api.conf"
19
-+    #run_process disco "contrail-discovery --conf_file /etc/contrail/contrail-discovery.conf"
20
-+    run_process svc-mon "/usr/bin/contrail-svc-monitor --conf_file /etc/contrail/contrail-svc-monitor.conf"
21
-+    run_process schema "/usr/bin/contrail-schema --conf_file /etc/contrail/contrail-schema.conf"
22
-+    run_process control "/usr/bin/contrail-control --conf_file /etc/contrail/contrail-control.conf" ubuntu root
23
-+    run_process collector "/usr/bin/contrail-collector --conf_file /etc/contrail/contrail-collector.conf"
24
-+    run_process analytic-api "/usr/bin/contrail-analytics-api --conf_file /etc/contrail/contrail-analytics-api.conf"
25
-     run_process alarm-gen "/usr/bin/contrail-alarm-gen --conf_file /etc/contrail/contrail-alarm-gen.conf"
26
--    run_process query-engine "contrail-query-engine --conf_file /etc/contrail/contrail-query-engine.conf"
27
--    run_process dns "contrail-dns --conf_file /etc/contrail/dns/contrail-dns.conf"
28
-+    run_process query-engine "/usr/bin/contrail-query-engine --conf_file /etc/contrail/contrail-query-engine.conf"
29
-+    run_process dns "/usr/bin/contrail-dns --conf_file /etc/contrail/dns/contrail-dns.conf"
30
-     #NOTE: contrail-dns checks for '/usr/bin/contrail-named' in /proc/[pid]/cmdline to retrieve bind status
31
--    run_process named "sudo /usr/bin/contrail-named -g -c /etc/contrail/dns/contrail-named.conf"
32
-+    run_process named "/usr/bin/contrail-named -g -c /etc/contrail/dns/contrail-named.conf -u ubuntu" ubuntu root
33
-
34
-     run_process ui-jobs "cd $CONTRAIL_DEST/contrail-web-core; sudo nodejs jobServerStart.js"
35
-     run_process ui-webs "cd $CONTRAIL_DEST/contrail-web-core; sudo nodejs webServerStart.js"

+ 0
- 41
playbooks/roles/contrail_vm/files/plugin.patch View File

@@ -1,41 +0,0 @@
1
---- /opt/stack/contrail/devstack/plugin.sh	2017-07-28 11:24:23.565728545 +0000
2
-+++ /home/ubuntu/contrail_plugin_zioc/plugin.sh.new	2017-07-28 11:29:49.693737003 +0000
3
-@@ -62,11 +62,11 @@
4
-     echo "Installing cassanadra CPP drivers"
5
-     TMP_PKG_DIR=$(mktemp -d)
6
-     cd $TMP_PKG_DIR
7
--
8
-+    
9
-     wget http://downloads.datastax.com/cpp-driver/ubuntu/$os_RELEASE/cassandra/v2.5.0/cassandra-cpp-driver_2.5.0-1_amd64.deb
10
-     wget http://downloads.datastax.com/cpp-driver/ubuntu/$os_RELEASE/cassandra/v2.5.0/cassandra-cpp-driver-dev_2.5.0-1_amd64.deb
11
-     wget http://downloads.datastax.com/cpp-driver/ubuntu/$os_RELEASE/dependencies/libuv/v1.8.0/libuv_1.8.0-1_amd64.deb
12
--
13
-+    
14
-     sudo dpkg -i *.deb
15
- 
16
-     cd $TOP_DIR
17
-@@ -176,6 +176,7 @@
18
-     run_process control "sudo contrail-control --conf_file /etc/contrail/contrail-control.conf"
19
-     run_process collector "contrail-collector --conf_file /etc/contrail/contrail-collector.conf"
20
-     run_process analytic-api "contrail-analytics-api --conf_file /etc/contrail/contrail-analytics-api.conf"
21
-+    run_process alarm-gen "/usr/bin/contrail-alarm-gen --conf_file /etc/contrail/contrail-alarm-gen.conf"
22
-     run_process query-engine "contrail-query-engine --conf_file /etc/contrail/contrail-query-engine.conf"
23
-     run_process dns "contrail-dns --conf_file /etc/contrail/dns/contrail-dns.conf"
24
-     #NOTE: contrail-dns checks for '/usr/bin/contrail-named' in /proc/[pid]/cmdline to retrieve bind status
25
-@@ -183,7 +184,6 @@
26
- 
27
-     run_process ui-jobs "cd $CONTRAIL_DEST/contrail-web-core; sudo nodejs jobServerStart.js"
28
-     run_process ui-webs "cd $CONTRAIL_DEST/contrail-web-core; sudo nodejs webServerStart.js"
29
--
30
-     SCREEN_NAME="$STACK_SCREEN_NAME"
31
- }
32
- 
33
-@@ -372,7 +372,7 @@
34
- 
35
-     echo_summary "Provisionning contrail"
36
- 
37
--    local provision_api_args="--api_server_ip $SERVICE_HOST --api_server_port 8082 \
38
-+    local provision_api_args="--api_server_ip $APISERVER_IP --api_server_port 8082 \
39
-         --admin_user $CONTRAIL_ADMIN_USER --admin_password $CONTRAIL_ADMIN_PASSWORD --admin_tenant_name $CONTRAIL_ADMIN_PROJECT"
40
- 
41
-     if is_service_enabled vrouter ; then

+ 0
- 4
playbooks/roles/contrail_vm/meta/main.yml View File

@@ -1,4 +0,0 @@
1
----
2
-dependencies:
3
-  - { role: common }
4
-  - { role: fetch_devstack, vm_group: contrail }

+ 0
- 26
playbooks/roles/contrail_vm/tasks/contrail_patches.yml View File

@@ -1,26 +0,0 @@
1
----
2
-# copy set of patches used to setup Contrail VM
3
-- name: copy contrail_patches
4
-  copy:
5
-    src: ../files/contrail_patches
6
-    dest: ~/devstack/contrail_patches
7
- 
8
-- name: copy plugin.patch
9
-  copy:
10
-    src: ../files/plugin.patch
11
-    dest: ~/devstack/plugin.patch
12
-
13
-- name: copy contrail_plugin_diff.patch
14
-  copy:
15
-    src: ../files/contrail_plugin_diff.patch
16
-    dest: ~/devstack/contrail_plugin_diff.patch
17
-
18
-- name: copy contrail_config.patch
19
-  copy:
20
-    src: ../files/contrail_config.patch
21
-    dest: ~/devstack/contrail_config.patch
22
-
23
-- name: Copy Analytisc SConscript Patch
24
-  copy:
25
-    src: ../files/Analytics-SConscript.patch
26
-    dest: ~/devstack/Analytics-SConscript.patch

+ 0
- 20
playbooks/roles/contrail_vm/tasks/dependencies.yml View File

@@ -1,20 +0,0 @@
1
----
2
-# copy set of patches used to setup Contrail VM
3
-- name: install fixtures
4
-  pip: 
5
-    name: "{{ item }}"
6
-  become: yes
7
-  become_method: sudo
8
-  with_items:
9
-    - 'fixtures'
10
-
11
-- name: Install build dependencies
12
-  apt:
13
-    name: "{{ item }}"
14
-  become: yes
15
-  become_method: sudo
16
-  with_items:
17
-    - 'libvirt-bin'
18
-    - 'qemu-kvm'
19
-    - 'libcrypto++-dev'
20
-    - 'libboost-thread1.58-dev'

+ 0
- 30
playbooks/roles/contrail_vm/tasks/kernel.yml View File

@@ -1,30 +0,0 @@
1
----
2
-# install supported kernel version
3
-- name: 'install supported kernel version {{ kernel_version }}'
4
-  apt:
5
-    name: "{{ item }}"
6
-    update_cache: yes
7
-    cache_valid_time: 3600
8
-  with_items:
9
-    - "linux-image-{{ kernel_version }}-generic"
10
-    - "linux-headers-{{ kernel_version }}-generic"
11
-  become: yes
12
-  register: kernel_install
13
-
14
-# reboot VM
15
-- name: reboot VM to boot with newly installed kernel
16
-  command: shutdown -r now "Ansible updates triggered" removes=/var/run/reboot-required
17
-  async: 0
18
-  poll: 0
19
-  become: yes
20
-  become_method: sudo
21
-  when: kernel_install | changed
22
-  register: restarted
23
-
24
-- name: wait for SSH on VM
25
-  local_action: shell ssh {{ inventory_hostname }} true
26
-  register: result
27
-  until: result | success
28
-  retries: 30
29
-  delay: 10
30
-  when: restarted | changed

+ 0
- 7
playbooks/roles/contrail_vm/tasks/main.yml View File

@@ -1,7 +0,0 @@
1
----
2
-# Setting up OpenContrail VM with Contrail service DISABLED
3
-
4
-- include: kernel.yml
5
-- include: dependencies.yml
6
-- include: contrail_patches.yml
7
-- include: stack_sh.yml

+ 0
- 18
playbooks/roles/contrail_vm/tasks/stack_sh.yml View File

@@ -1,18 +0,0 @@
1
----
2
-# Run stack.sh in case if it is already running, unstack first
3
-
4
-- name: optionally unstack
5
-  shell: screen -ls | grep stack && ./unstack.sh
6
-  args:
7
-    chdir: ~/devstack
8
-  ignore_errors: yes
9
-
10
-- name: build OpenContrail via stack.sh
11
-  shell: ./stack.sh
12
-  args:
13
-    chdir: ~/devstack
14
-  register: task_result
15
-  until: task_result.rc == 0
16
-  retries: 3
17
-  delay: 1
18
-  ignore_errors: yes 

+ 41
- 0
playbooks/roles/devstack_compute_node/tasks/main.yml View File

@@ -0,0 +1,41 @@
1
+---
2
+- name: Install required utilities
3
+  become: yes
4
+  yum:
5
+    name: "{{ item }}"
6
+    state: present
7
+  with_items:
8
+    - lvm2
9
+    - git
10
+
11
+- name: Fetch devstack
12
+  git:
13
+    repo: "https://github.com/openstack-dev/devstack.git"
14
+    dest: ~/devstack
15
+    version: "{{ openstack_branch }}"
16
+    accept_hostkey: yes
17
+    force: yes
18
+
19
+- name: Fetch devstack requirements
20
+  become: yes
21
+  git:
22
+    repo: "git://git.openstack.org/openstack/requirements.git"
23
+    dest: /opt/stack/requirements
24
+    version: "{{ openstack_branch }}"
25
+    accept_hostkey: yes
26
+    force: yes
27
+
28
+# If there are any problems with libvirt, then the version of libvirt should be upgraded in devstack requirements.
29
+#
30
+# The version of libvirt-python must be the same as, or newer than the version of the libvirt C library you're building against.
31
+# source: https://www.redhat.com/archives/libvirt-users/2017-September/msg00003.html
32
+# Since 2018-05-10 the newest libvirt package for centos7 is 3.9.0
33
+# Alternatively install libvirt 2.5.0 and lock package, so yum can't update it https://www.tecmint.com/yum-lock-disable-blacklist-certain-package-update-version/
34
+- name: Fix libvirt version
35
+  become: yes
36
+  shell: sed -i 's/libvirt-python===2.5.0/libvirt-python===3.9.0/' /opt/stack/requirements/upper-constraints.txt
37
+
38
+- name: Put local.conf
39
+  template:
40
+    src: compute_local.conf.j2
41
+    dest: ~/devstack/local.conf

+ 36
- 0
playbooks/roles/devstack_compute_node/templates/compute_local.conf.j2 View File

@@ -0,0 +1,36 @@
1
+[[local|localrc]]
2
+DEST=/opt/stack
3
+
4
+HOST_IP={{ contrail_ip }}
5
+SERVICE_HOST={{ openstack_ip }}
6
+MULTI_HOST=1
7
+
8
+LOGFILE=$DEST/logs/stack.sh.log
9
+LOGDAYS=1
10
+
11
+ADMIN_PASSWORD=admin
12
+DATABASE_PASSWORD=$ADMIN_PASSWORD
13
+RABBIT_PASSWORD=$ADMIN_PASSWORD
14
+SERVICE_PASSWORD=$ADMIN_PASSWORD
15
+
16
+USE_BRANCH={{ openstack_branch }}
17
+
18
+NOVA_BRANCH=$USE_BRANCH
19
+CINDER_BRANCH=$USE_BRANCH
20
+GLANCE_BRANCH=$USE_BRANCH
21
+HORIZON_BRANCH=$USE_BRANCH
22
+KEYSTONE_BRANCH=$USE_BRANCH
23
+NEUTRON_BRANCH=$USE_BRANCH
24
+
25
+MYSQL_HOST=$SERVICE_HOST
26
+RABBIT_HOST=$SERVICE_HOST
27
+GLANCE_HOSTPORT=$SERVICE_HOST:9292
28
+ENABLED_SERVICES=n-cpu,q-agt,n-api-meta,placement-client,q-dhcp
29
+
30
+NOVA_VNC_ENABLED=True
31
+NOVNCPROXY_URL="http://{{ hostvars['controller'].ansible_host }}:6080/vnc_auto.html"
32
+VNCSERVER_LISTEN=$HOST_IP
33
+VNCSERVER_PROXYCLIENT_ADDRESS=$VNCSERVER_LISTEN
34
+
35
+LOG_COLOR=True
36
+USE_SCREEN=True

playbooks/roles/fetch_devstack/tasks/fetch_devstack.yml → playbooks/roles/devstack_controller_node/tasks/main.yml View File

@@ -1,14 +1,12 @@
1 1
 ---
2
-# Prepare VM to install devstack
3
-- name: checkout devstack
4
-  git: 
2
+- name: Fetch devstack
3
+  git:
5 4
     repo: "https://github.com/openstack-dev/devstack.git"
6
-    dest: ~/devstack 
5
+    dest: ~/devstack
7 6
     version: "{{ openstack_branch }}"
8 7
     accept_hostkey: yes
9 8
     force: yes
10
-
11
-- name: local.conf
9
+- name: Put local.conf
12 10
   template:
13
-    src: ../templates/{{ vm_group }}_local.conf.j2
11
+    src: controller_local.conf.j2
14 12
     dest: ~/devstack/local.conf

+ 54
- 0
playbooks/roles/devstack_controller_node/templates/controller_local.conf.j2 View File

@@ -0,0 +1,54 @@
1
+[[local|localrc]]
2
+DEST=/opt/stack
3
+
4
+HOST_IP='{{ openstack_ip }}'
5
+SERVICE_HOST=$HOST_IP
6
+MULTI_HOST=False
7
+
8
+LOGFILE=$DEST/logs/stack.sh.log
9
+LOGDAYS=1
10
+
11
+ADMIN_PASSWORD=admin
12
+DATABASE_PASSWORD=$ADMIN_PASSWORD
13
+RABBIT_PASSWORD=$ADMIN_PASSWORD
14
+SERVICE_PASSWORD=$ADMIN_PASSWORD
15
+
16
+USE_BRANCH={{ openstack_branch }}
17
+
18
+NOVA_BRANCH=$USE_BRANCH
19
+CINDER_BRANCH=$USE_BRANCH
20
+GLANCE_BRANCH=$USE_BRANCH
21
+HORIZON_BRANCH=$USE_BRANCH
22
+KEYSTONE_BRANCH=$USE_BRANCH
23
+NEUTRON_BRANCH=$USE_BRANCH
24
+
25
+LOG_COLOR=True
26
+USE_SCREEN=True
27
+
28
+disable_service n-net c-sch c-api c-vol dstat tempest
29
+
30
+NEUTRON_CREATE_INITIAL_NETWORKS=False
31
+
32
+Q_USE_SECGROUP=True
33
+Q_PLUGIN=ml2
34
+
35
+ML2_L3_PLUGIN=opencontrail-router
36
+
37
+OPENCONTRAIL_APISERVER_IP='{{ contrail_ip }}'
38
+OPENCONTRAIL_APISERVER_PORT=8082
39
+
40
+NOVNCPROXY_URL="http://{{ hostvars['controller'].ansible_host }}:6080/vnc_auto.html"
41
+
42
+enable_plugin networking-opencontrail https://git.openstack.org/openstack/networking-opencontrail $USE_BRANCH
43
+
44
+PHYSICAL_NETWORK=vhost
45
+TENANT_VLAN_RANGE=1:4094
46
+Q_ML2_TENANT_NETWORK_TYPE=vlan
47
+Q_ML2_PLUGIN_MECHANISM_DRIVERS=opencontrail
48
+
49
+[[post-config|$NEUTRON_CORE_PLUGIN_CONF]]
50
+[ml2]
51
+type_drivers = local,flat,vlan,gre,vxlan,geneve
52
+tenant_network_types = vlan,vxlan
53
+mechanism_drivers = opencontrail,openvswitch,linuxbridge
54
+extension_drivers = port_security

+ 0
- 11
playbooks/roles/fetch_devstack/defaults/main.yml View File

@@ -1,11 +0,0 @@
1
----
2
-# default nameserver
3
-nameserver: 8.8.8.8
4
-
5
-# default variables values for VMs
6
-multihost: True
7
-create_initial_networks: False
8
-service_token: token
9
-admin_pass: admin
10
-# default OpenContrail API port number
11
-contrail_port: 8082

+ 0
- 3
playbooks/roles/fetch_devstack/meta/main.yml View File

@@ -1,3 +0,0 @@
1
----
2
-dependencies:
3
-  - { role: common }

+ 0
- 4
playbooks/roles/fetch_devstack/tasks/main.yml View File

@@ -1,4 +0,0 @@
1
----
2
-# Fetch devstack and prepare configuration in local.conf file
3
-
4
-- include: fetch_devstack.yml

+ 0
- 47
playbooks/roles/fetch_devstack/templates/contrail_local.conf.j2 View File

@@ -1,47 +0,0 @@
1
-# {{ ansible_managed }}
2
-[[local|localrc]]
3
-SERVICE_TOKEN={{ service_token }}
4
-HOST_IP={{ contrail_ip }}
5
-SERVICE_HOST={{ openstack_ip }}
6
-MULTI_HOST={{ multihost }}
7
-LOGFILE=/opt/stack/logs/stack.sh.log
8
-LOGDAYS=1
9
-ADMIN_PASSWORD={{ admin_pass }}
10
-DATABASE_PASSWORD=$ADMIN_PASSWORD
11
-RABBIT_PASSWORD=$ADMIN_PASSWORD
12
-SERVICE_PASSWORD=$ADMIN_PASSWORD
13
-
14
-#Newton Branches
15
-NOVA_BRANCH={{ openstack_branch }}
16
-NEUTRON_BRANCH={{ openstack_branch }}
17
-
18
-LOG_COLOR=True
19
-MYSQL_HOST=$SERVICE_HOST
20
-RABBIT_HOST=$SERVICE_HOST
21
-Q_HOST=$SERVICE_HOST
22
-
23
-USE_SCREEN=True
24
-
25
-# starting from Ocata release placement-api is required 
26
-# and has to be enabled as well
27
-{% if 'newton' in openstack_branch %}
28
-ENABLED_SERVICES=nova,neutron,vrouter,api-srv,svc-mon,schema,control,collector,analytic-api,query-engine,dns,named,ui-jobs,ui-webs,alarm-gen
29
-#ENABLED_SERVICES+=,n-cpu
30
-{% else %}
31
-ENABLED_SERVICES=neutron,nova,vrouter,api-srv,svc-mon,schema,control,collector,analytic-api,query-engine,dns,named,ui-jobs,ui-webs,alarm-gen
32
-#ENABLED_SERVICES+=,n-cpu,placement-api
33
-{% endif %}
34
-
35
-# if OpenContrail release in R3.x enable discovery service
36
-{% if contrail_branch[1] == '3' %}
37
-ENABLED_SERVICES+=,disco
38
-{% endif %}
39
-
40
-NEUTRON_CREATE_INITIAL_NETWORKS={{ create_initial_networks }}
41
-
42
-CONTRAIL_BRANCH={{ contrail_branch }}
43
-CONTRAIL_PATCHES='contrail_patches'
44
-CONFIG_IP=$HOST_IP
45
-enable_plugin contrail https://github.com/zioc/contrail-devstack-plugin.git
46
-# Use this with precaution. You have to run multiples time the compilation before it succeed with parallel jobs
47
-SCONS_JOBS=$(($(lscpu -p | grep -cve '^#')+1))

+ 0
- 35
playbooks/roles/fetch_devstack/templates/openstack_local.conf.j2 View File

@@ -1,35 +0,0 @@
1
-[[local|localrc]]
2
-SERVICE_TOKEN={{ service_token }}
3
-HOST_IP={{ openstack_ip }}
4
-SERVICE_HOST=$HOST_IP
5
-MULTI_HOST={{ multihost }}
6
-LOGFILE=/opt/stack/logs/stack.sh.log
7
-LOGDAYS=1
8
-ADMIN_PASSWORD={{ admin_pass }}
9
-DATABASE_PASSWORD=$ADMIN_PASSWORD
10
-RABBIT_PASSWORD=$ADMIN_PASSWORD
11
-SERVICE_PASSWORD=$ADMIN_PASSWORD
12
-
13
-# OpenStack Branches
14
-NOVA_BRANCH={{ openstack_branch }}
15
-CINDER_BRANCH={{ openstack_branch }}
16
-GLANCE_BRANCH={{ openstack_branch }}
17
-HORIZON_BRANCH={{ openstack_branch }}
18
-KEYSTONE_BRANCH={{ openstack_branch }}
19
-NEUTRON_BRANCH={{ openstack_branch }}
20
-
21
-LOG_COLOR=True
22
-USE_SCREEN=True
23
-disable_service n-net n-cpu c-sch c-api c-vol q-dhcp q-agt q-l3 dstat tempest
24
-
25
-NEUTRON_CREATE_INITIAL_NETWORKS={{ create_initial_networks }}
26
-Q_USE_SECGROUP=True
27
-Q_PLUGIN=ml2
28
-
29
-ML2_L3_PLUGIN=opencontrail-router
30
-
31
-OPENCONTRAIL_APISERVER_IP='{{ contrail_ip }}'
32
-OPENCONTRAIL_APISERVER_PORT={{ contrail_port }}
33
-
34
-enable_plugin networking-opencontrail https://github.com/openstack/networking-opencontrail
35
-#enable_plugin networking-opencontrail https://github.com/openstack/networking-opencontrail stable/ocata

BIN
playbooks/roles/networking_bgpvpn_plugin/files/cfgm_common-0.1.dev0.tar.gz View File


BIN
playbooks/roles/networking_bgpvpn_plugin/files/vnc_api-5.0.0.tar.gz View File


+ 75
- 0
playbooks/roles/networking_bgpvpn_plugin/tasks/main.yml View File

@@ -0,0 +1,75 @@
1
+---
2
+- name: Install system requirements
3
+  become: yes
4
+  apt:
5
+    name: "{{ item }}"
6
+    state: present
7
+  with_items:
8
+    - python-pip
9
+
10
+- name: Update local.conf with enabling plugin
11
+  lineinfile:
12
+    path: ~/devstack/local.conf
13
+    regexp: '^enable_plugin networking-bgpvpn'
14
+    line: 'enable_plugin networking-bgpvpn git://git.openstack.org/openstack/networking-bgpvpn.git stable/ocata'
15
+    insertafter: 'enable_plugin'
16
+
17
+- name: Update local.conf with driver
18
+  lineinfile:
19
+    path: ~/devstack/local.conf
20
+    regexp: '^NETWORKING_BGPVPN_DRIVER'
21
+    line: 'NETWORKING_BGPVPN_DRIVER="BGPVPN:OpenContrail:neutron_plugin_contrail.plugins.opencontrail.networking_bgpvpn.contrail.ContrailBGPVPNDriver:default"'
22
+    insertafter: 'enable_plugin'
23
+
24
+- name: Prepare directory for fetching repository
25
+  become: true
26
+  file:
27
+    path: /opt/stack/networking-bgpvpn
28
+    state: directory
29
+    owner: "{{ ansible_user_id }}"
30
+    group: "{{ ansible_user_id }}"
31
+    mode: 0775
32
+
33
+- name: Fetch git repository
34
+  git:
35
+    repo: "git://git.openstack.org/openstack/networking-bgpvpn.git"
36
+    dest: /opt/stack/networking-bgpvpn
37
+    version: "{{ openstack_branch }}"
38
+    accept_hostkey: yes
39
+    force: yes
40
+
41
+- name: Move source of neutron to post-config phase
42
+  lineinfile:
43
+    state: absent
44
+    path: /opt/stack/networking-bgpvpn/devstack/plugin.sh
45
+    regexp: '^source \$NEUTRON_DIR/devstack/lib/l2_agent$'
46
+
47
+- name: Move source of neutron to post-config phase
48
+  lineinfile:
49
+    state: present
50
+    path: /opt/stack/networking-bgpvpn/devstack/plugin.sh
51
+    line: '        source $NEUTRON_DIR/devstack/lib/l2_agent'
52
+    insertbefore: 'plugin_agent_add_l2_agent_extension'
53
+
54
+- name: fix requirements.txt
55
+  lineinfile:
56
+    path: /opt/stack/networking-bgpvpn/test-requirements.txt
57
+    state: absent
58
+    regexp: 'networking-odl'
59
+
60
+- name: copy pip dependencies
61
+  copy:
62
+    src: "../files/{{ item }}"
63
+    dest: /tmp
64
+  with_items:
65
+    - 'cfgm_common-0.1.dev0.tar.gz'
66
+    - 'vnc_api-5.0.0.tar.gz'
67
+
68
+- name: install dependencies
69
+  pip:
70
+    name: "{{ item }}"
71
+  become: yes
72
+  with_items:
73
+    - '/tmp/cfgm_common-0.1.dev0.tar.gz'
74
+    - '/tmp/vnc_api-5.0.0.tar.gz'
75
+    - 'git+git://github.com/Juniper/contrail-neutron-plugin.git#egg=neutron_plugin_contrail'

+ 0
- 11
playbooks/roles/openstack_vm/files/keystone.patch View File

@@ -1,11 +0,0 @@
1
---- keystone.orig	2017-07-30 22:16:21.425892580 +0200
2
-+++ keystone	2017-07-30 22:14:06.043517113 +0200
3
-@@ -649,7 +649,7 @@
4
-         --bootstrap-role-name admin \
5
-         --bootstrap-service-name keystone \
6
-         --bootstrap-region-id "$REGION_NAME" \
7
--        --bootstrap-admin-url "$KEYSTONE_AUTH_URI" \
8
-+        --bootstrap-admin-url "$KEYSTONE_AUTH_URI/v2.0" \
9
-         --bootstrap-public-url "$KEYSTONE_SERVICE_URI" \
10
-         --bootstrap-internal-url "$KEYSTONE_SERVICE_URI"
11
- }

+ 0
- 10
playbooks/roles/openstack_vm/files/keystone_stable-pike.patch View File

@@ -1,10 +0,0 @@
1
---- keystone.orig	2018-01-09 10:50:01.005819940 +0000
2
-+++ keystone	2018-01-09 10:50:18.133820750 +0000
3
-@@ -607,7 +607,7 @@
4
-         --bootstrap-role-name admin \
5
-         --bootstrap-service-name keystone \
6
-         --bootstrap-region-id "$REGION_NAME" \
7
--        --bootstrap-admin-url "$KEYSTONE_AUTH_URI" \
8
-+        --bootstrap-admin-url "$KEYSTONE_AUTH_URI/v2.0" \
9
-         --bootstrap-public-url "$KEYSTONE_SERVICE_URI"
10
- }

+ 0
- 5
playbooks/roles/openstack_vm/meta/main.yml View File

@@ -1,5 +0,0 @@
1
----
2
-dependencies:
3
-  - { role: common }
4
-  - { role: fetch_devstack, vm_group: openstack }
5
-#  - { role: contrail_vm }

+ 0
- 8
playbooks/roles/openstack_vm/tasks/main.yml View File

@@ -1,8 +0,0 @@
1
----
2
-# setting up Openstack VM
3
-
4
-- include: openstack_patch.yml
5
-
6
-#- include: install_drv_depend.yml
7
-
8
-- include: stack_sh.yml

+ 0
- 14
playbooks/roles/openstack_vm/tasks/openstack_patch.yml View File

@@ -1,14 +0,0 @@
1
----
2
-# Patch stack.sh for proper endpoints used by OpenContrail controller
3
-- name: copy Openstack endpoint patch
4
-  copy:
5
-    src: "{{ item }}"
6
-    dest: ~/devstack/keystone.patch
7
-  with_first_found:
8
-    - ../files/keystone_{{ openstack_branch | regex_replace('/', '-') }}.patch
9
-    - ../files/keystone.patch
10
-
11
-- name: patch keystone endpoint 
12
-  shell: patch keystone < ../keystone.patch
13
-  args:
14
-    chdir: ~/devstack/lib

+ 0
- 12
playbooks/roles/openstack_vm/tasks/stack_sh.yml View File

@@ -1,12 +0,0 @@
1
----
2
-# Run stack.sh in case if it is already running, unstack first
3
-
4
-- name: optionally unstack
5
-  shell: screen -ls | grep stack && ./unstack.sh
6
-  args:
7
-    chdir: ~/devstack
8
-  ignore_errors: yes
9
-
10
-- name: build OpenStack via stack.sh
11
-  command: chdir=~/devstack ./stack.sh
12
-  ignore_errors: no

+ 15
- 0
playbooks/roles/restack_compute_node/tasks/main.yml View File

@@ -0,0 +1,15 @@
1
+---
2
+- name: optionally unstack
3
+  shell: PATH="/usr/sbin:$PATH" ./unstack.sh
4
+  args:
5
+    chdir: ~/devstack
6
+  ignore_errors: yes
7
+
8
+- name: build OpenStack via stack.sh
9
+  command: ./stack.sh
10
+  args:
11
+    chdir: ~/devstack
12
+
13
+- name: discover hosts on openstack
14
+  delegate_to: "{{ hostvars['controller'].ansible_host }}"
15
+  shell: nova-manage cell_v2 discover_hosts

+ 0
- 5
playbooks/roles/restack_contrail/tasks/main.yml View File

@@ -1,5 +0,0 @@
1
----
2
-# setting up again OpenContrail VM
3
-- include: unstack_sh.yml
4
-- include: services.yml
5
-- include: stack_sh.yml

+ 0
- 10
playbooks/roles/restack_contrail/tasks/services.yml View File

@@ -1,10 +0,0 @@
1
----
2
-# setup local.conf for restacking 
3
-- name: uncomment n-cpu & placement-api (if needed)
4
-  lineinfile:
5
-    dest: ~/devstack/local.conf 
6
-    regexp: (?i)^\s*#\s*({{ item }}.*)
7
-    line: \1
8
-    backrefs: yes
9
-  with_items:
10
-    - 'ENABLED_SERVICES' 

+ 0
- 14
playbooks/roles/restack_contrail/tasks/stack_sh.yml View File

@@ -1,14 +0,0 @@
1
----
2
-# Run stack.sh in case if it is already running, unstack first
3
-
4
-- name: optionally unstack
5
-  shell: screen -ls | grep stack && ./unstack.sh
6
-  args:
7
-    chdir: ~/devstack
8
-  ignore_errors: yes
9
-
10
-- name: stack.sh again Contrail
11
-  shell: ./stack.sh
12
-  args:
13
-    chdir: ~/devstack
14
-  ignore_errors: no

+ 0
- 5
playbooks/roles/restack_contrail/tasks/unstack_sh.yml View File

@@ -1,5 +0,0 @@
1
----
2
-# run unstack.sh
3
-- name: unstack.sh Contrail node
4
-  command: chdir=~/devstack ./unstack.sh
5
-  ignore_errors: no

+ 11
- 0
playbooks/roles/restack_controller_node/tasks/main.yml View File

@@ -0,0 +1,11 @@
1
+---
2
+- name: optionally unstack
3
+  shell: ./unstack.sh
4
+  args:
5
+    chdir: ~/devstack
6
+  ignore_errors: yes
7
+
8
+- name: build OpenStack via stack.sh
9
+  command: ./stack.sh
10
+  args:
11
+    chdir: ~/devstack

+ 0
- 3
playbooks/roles/source_openrc/tasks/main.yml View File

@@ -1,3 +0,0 @@
1
----
2
-# source openrc
3
-- include: source_openrc.yml

+ 0
- 11
playbooks/roles/source_openrc/tasks/source_openrc.yml View File

@@ -1,11 +0,0 @@
1
----
2
-# source openrc in bash profile
3
-- name: source openrc in profile
4
-  lineinfile: 
5
-    dest: ~/.profile 
6
-    regexp: ".*openrc" 
7
-    line: ". ~/devstack/openrc"
8
-    state: present
9
-
10
-- name: source openrc in current shell
11
-  shell: . ~/devstack/openrc

Loading…
Cancel
Save