/
main.yml
101 lines (88 loc) · 3.06 KB
/
main.yml
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
---
#
# Copyright (c) 2016, PLUMgrid Inc, http://plumgrid.com
#
# 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.
# Check if an upgrade and remove stale entries of previous install
- name: Check if PLUMgrid plugin is installed
command: dpkg-query -l networking-plumgrid
register: deb_check
ignore_errors: yes
- name: Register networking-plumgrid version
shell: >
dpkg -l | grep networking-plumgrid | awk '{print $3}'
register: np_ver
when: deb_check.rc == 0
- name: Unlink previous networking-plumgrid files (venv)
shell: >
{{ item.state }} {{ item.name }}
with_items:
- { state: unlink, name: "{{ neutron_venv_lib_dir }}networking_plumgrid" }
- { state: unlink, name: "{{ neutron_venv_lib_dir }}networking_plumgrid-{{ np_ver.stdout }}-py2.7.egg-info" }
when:
- neutron_venv_enabled | bool
- deb_check.rc == 0
ignore_errors: yes
# Remove sources file if exists
- name: Removing pre-exiting sources.list
file: path=/etc/apt/sources.list.d/plumgrid.list state=absent
# Create a PLUMgrid sources.list
- name: Create plumgrid sources.list
lineinfile:
dest: /etc/apt/sources.list.d/plumgrid.list
line: "deb {{ plumgrid_repo }}/plumgrid plumgrid {{ plumgrid_component }}"
state: present
create: yes
# Point to valid PLUMgrid repo
- name: Add plumgrid-images to repo
lineinfile:
dest: /etc/apt/sources.list.d/plumgrid.list
line: "deb {{ plumgrid_repo }}/plumgrid-images plumgrid {{ plumgrid_component }}"
state: present
# Add PLUMgrid openstack to repo
- name: Add PLUMgrid openstack to repo
lineinfile:
dest: /etc/apt/sources.list.d/plumgrid.list
line: "deb {{ plumgrid_repo }}/openstack/deb/{{ openstack_version }} openstack-{{ openstack_version }} {{ plumgrid_component }}"
state: present
# Copy GPG-key file to target nodes
- name: Copy Plumgrid GPG-key file
template:
src: "{{ gpg_keypath }}"
dest: /tmp/GPG-KEY
# Create GPG-key
- name: Add Plumgrid GPG-key
apt_key:
file: /tmp/GPG-KEY
state: present
# Update repositories
- name: Running apt-update
apt:
update_cache: yes
# Install package plumgrid-pythonlib
- name: Install plumgrid-pythonlib
apt:
name: plumgrid-pythonlib
state: latest
force: yes
# Link plumgrid ini
- name: Link plumgrid ini
lineinfile:
dest: "/etc/default/neutron-server"
line: "NEUTRON_PLUGIN_CONFIG=\"/etc/neutron/plugins/plumgrid/plumgrid.ini\""
state: present
create: yes
- name: Start neutron server
service: name=neutron-server state=started
register: service_started
failed_when: "'msg' in service_started and 'FAIL' in service_started.msg|upper"