-
Notifications
You must be signed in to change notification settings - Fork 1
/
install-wistar.yml
198 lines (172 loc) · 4.28 KB
/
install-wistar.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
---
#
# Provisions all the required dependencies for Wistar on the local host
#
- name: Provision Wistar
hosts: localhost
connection: local
become: true
tasks:
- name: Update all packages to the latest version
apt:
upgrade: dist
update_cache: yes
- name: Install Junos-eznc dependancies
apt:
name: "{{ item }}"
state: present
with_items:
- build-essential
- libxml2-dev
- libxslt1-dev
- libz-dev
- libffi-dev
- libssl-dev
- python-dev
- git
- python-pip
- name: Install python-cryptography
pip:
name: cryptography
editable: false
- name: Install junos-eznc
pip:
name: junos-eznc
editable: false
- name: Install jxmlease
pip:
name: jxmlease
editable: false
- name: Install Wistar dependancies
apt:
name: "{{ item }}"
state: present
update_cache: true
with_items:
- qemu-kvm
- libvirt-bin
- socat
- python-pexpect
- python-libvirt
- python-yaml
- unzip
- bridge-utils
- python-numpy
- genisoimage
- python-netaddr
- python-markupsafe
- python-setuptools
- mtools
- name: Install Django
pip:
name: django
version: 1.9.9
editable: false
- name: Install Python virtualBox
pip:
name: pyvbox
editable: false
- name: Create Wistar directory structure 1
file:
path: /opt/wistar
state: directory
- name: Create Wistar directory structure 2
file:
path: /opt/wistar/user_images
state: directory
- name: Create Wistar directory structure 3
file:
path: /opt/wistar/wistar-master
state: directory
- name: Create Wistar directory structure 4
file:
path: /opt/wistar/media
state: directory
- name: Create Wistar directory structure 5
file:
path: /opt/wistar/seeds
state: directory
- name: Create Wistar directory structure 6
file:
path: /opt/wistar/user_images/instances
state: directory
- name: Pull latest Wistar from Git
git:
repo: https://github.com/Juniper/wistar.git
depth: 1
dest: /opt/wistar/wistar-master/
- name: Create Wistar tables
command: /opt/wistar/wistar-master/manage.py migrate
- name: install apache2
apt:
name: "{{ item }}"
state: present
with_items:
- apache2
- libapache2-mod-wsgi
- name: enable the Apache2 module "wsgi"
apache2_module:
state: present
name: wsgi
notify: restart apache
- name: set permissions on wistar dir
file:
path: /opt/wistar
owner: www-data
group: www-data
state: directory
recurse: yes
- name: set permissions on wistar log
file:
path: /var/log/wistar.log
owner: www-data
group: www-data
state: touch
- name: set permissions on wistar errorlog
file:
path: /var/log/apache2/wistar.log
owner: www-data
group: www-data
state: touch
- name: set permissions on wistar accesslog
file:
path: /var/log/apache2/wistar_access.log
owner: www-data
group: www-data
state: touch
- name: copy wistar config file to apache
copy:
src: 999-wistar.conf
dest: /etc/apache2/sites-available/999-wistar.conf
- name: enable wistar site in apache
file:
src: /etc/apache2/sites-available/999-wistar.conf
dest: /etc/apache2/sites-enabled/999-wistar.conf
state: link
notify: restart apache
- name: add www-data to libvirt users
user:
name: www-data
groups: libvirtd
append: yes
- name: Get the EVE-NG repo key
apt_key:
url: http://www.eve-ng.net/repo/eczema@ecze.com.gpg.key
state: present
- name: Add EVE-NG repository
apt_repository:
repo: deb [arch=amd64] http://www.eve-ng.net/repo xenial main
state: present
- name: Install the EVE-NG kernel
apt:
name: linux-image-4.9.40-eve-ng-ukms-2+
state: present
update_cache: yes
- name: Ensure apicv is turned off in kernel module (for srx)
lineinfile:
dest: /etc/modprobe.d/dist.conf
create: yes
line: options kvm_intel enable_apicv=n
handlers:
- name: restart apache
service: name=apache2 state=restarted