blob: a24be78b6b172ba46368590481e5f75a4f8840fb [file] [log] [blame]
Luca Prete8d4e8bc2016-08-24 14:49:54 -07001---
2#
3# Installs basic tutorial packages and configures common tutorial settings
4#
5- name: Downloading repo key
6 apt_key:
7 url: "{{ google_chrome_key_url }}"
8 state: present
9
10- name: Installing Google Chrome repo
11 apt_repository:
12 repo: "{{ google_chrome_repo }}"
13 state: present
14 filename: "google-chrome"
15
16- name: Installing Google Chrome
17 apt:
18 name: google-chrome-stable
19 force: yes
20 update_cache: yes
21
22- name: Creating reset scripts for 1 node cell
23 template:
24 src: templates/reset_one_node.j2
25 dest: "{{ reset_files[0] }}"
26 owner: ubuntu
27 group: ubuntu
28 mode: 0777
29
30- name: Creating reset scripts for 3 node cell
31 template:
32 src: templates/reset_three_node.j2
33 dest: "{{ reset_files[1] }}"
34 owner: ubuntu
35 group: ubuntu
36 mode: 0777
37
38- name: Creating tutorial users
39 user:
40 name: "{{ item.value.user }}"
41 groups: "wireshark"
42 append: yes
43 password: "{{ item.value.pass }}"
44 with_dict: "{{ tutorials }}"
45
46- name: Adding tutorial users to sudoers
47 lineinfile:
48 dest: "/etc/sudoers.d/{{ item.value.user }}"
49 line: "{{ item.value.user }} ALL=(ALL) NOPASSWD:ALL"
50 state: present
51 create: yes
52 with_dict: "{{ tutorials }}"
53
54- name: Creating .ssh folders
55 file:
56 path: "/home/{{ item.value.user }}/.ssh"
57 state: directory
58 owner: "{{ item.value.user }}"
59 group: "{{ item.value.user }}"
60 mode: 0700
61 with_dict: "{{ tutorials }}"
62
63- name: Copying .ssh keys
64 copy:
65 src: "/home/ubuntu/.ssh/id_rsa"
66 dest: "/home/{{ item.value.user }}/.ssh/id_rsa"
67 owner: "{{ item.value.user }}"
68 group: "{{ item.value.user }}"
69 mode: 0600
70 with_dict: "{{ tutorials }}"
71
72- name: Setting ONOS variables
73 blockinfile:
74 dest: "/home/{{ item.value.user }}/.bashrc"
75 create: yes
76 block: |
77 export ONOS_ROOT=/home/ubuntu/onos
78 export KARAF_ROOT=/home/ubuntu/Applications/apache-karaf-{{ karaf_version }}
79 export KARAF_TAR=/home/ubuntu/Applications/apache-karaf-{{ karaf_version }}.tar.gz
80 export M2_REPO=/home/ubuntu/.m2/repository
81 . /home/ubuntu/onos/tools/dev/bash_profile
82 cell {{ item.value.cell }} > /dev/null
83 with_dict: "{{ tutorials }}"
84
85- name: Creating .wireshark folders
86 file:
87 path: "/home/{{ item.value.user }}/{{ wireshark.plugins_dir }}"
88 state: directory
89 owner: "{{ item.value.user }}"
90 group: "{{ item.value.user }}"
91 mode: 0755
92 with_dict: "{{ tutorials }}"
93
94- name: Copying openflow.lua Wireshark plugin
95 copy:
96 src: "/home/ubuntu/openflow.lua"
97 dest: "/home/{{ item.value.user }}/{{ wireshark.plugins_dir }}"
98 owner: "{{ item.value.user }}"
99 group: "{{ item.value.user }}"
100 with_dict: "{{ tutorials }}"
101
102- name: Creating run_onos.sh script
103 template:
104 src: templates/run_onos.j2
105 dest: /home/ubuntu/run_onos.sh
106 owner: ubuntu
107 group: ubuntu
108 mode: 0777
109
110- name: Creating config Desktop folder
111 file:
112 path: "/home/{{ item.value.user }}/.config/pcmanfm/lubuntu/"
113 state: directory
114 owner: "{{ item.value.user }}"
115 group: "{{ item.value.user }}"
116 mode: 0777
117 with_dict: "{{ tutorials }}"
118
119- name: Loading ONOS Desktop background
120 template:
121 src: templates/gui_custom.j2
122 dest: "/home/{{ item.value.user }}/.config/pcmanfm/lubuntu/desktop-items-0.conf"
123 owner: "{{ item.value.user }}"
124 group: "{{ item.value.user }}"
125 mode: 0777
126 with_dict: "{{ tutorials }}"
127
128- name: Creating Desktop folders
129 file:
130 path: "/home/{{ item.value.user }}/Desktop"
131 state: directory
132 mode: 0755
133 with_dict: "{{ tutorials }}"
134
135- name: Creating ONOS CLI Desktop icons
136 blockinfile:
137 dest: "/home/{{ item.value.user }}/Desktop/ONOS CLI.desktop"
138 create: yes
139 owner: "{{ item.value.user }}"
140 group: "{{ item.value.user }}"
141 mode: 0777
142 block: |
143 [Desktop Entry]
144 Encoding=UTF-8
145 Type=Application
146 Name=ONOS
147 Name[en_US]=ONOS
148 Icon=konsole
149 Exec=/home/ubuntu/run_onos.sh
150 Comment[en_US]=
151 Terminal=true
152 X-KeepTerminal=true
153 with_dict: "{{ tutorials }}"
154
155- name: Creating Mininet Desktop icon
156 blockinfile:
157 dest: "/home/{{ item.value.user }}/Desktop/Mininet.desktop"
158 create: yes
159 owner: "{{ item.value.user }}"
160 group: "{{ item.value.user }}"
161 mode: 0777
162 block: |
163 [Desktop Entry]
164 Encoding=UTF-8
165 Type=Application
166 Name=Mininet
167 Name[en_US]=Mininet
168 Icon=konsole
169 Exec={{ item.value.mininet_exec }}
170 Comment[en_US]=
171 Terminal=true
172 X-KeepTerminal=true
173 with_dict: "{{ tutorials }}"
174
175- name: Creating Tutorial Desktop icons
176 blockinfile:
177 dest: "/home/{{ item.value.user }}/Desktop/Tutorial.desktop"
178 create: yes
179 owner: "{{ item.value.user }}"
180 group: "{{ item.value.user }}"
181 mode: 0777
182 block: |
183 [Desktop Entry]
184 Encoding=UTF-8
185 Type=Application
186 Name=ONOS Tutorial
187 Name[en_US]=ONOS Tutorial
188 Icon=internet-web-browser
189 Exec=/usr/bin/google-chrome-stable {{ item.value.url }}
190 Comment[en_US]=
191 with_dict: "{{ tutorials }}"
192
193- name: Creating GUI Desktop icons
194 blockinfile:
195 dest: "/home/{{ item.value.user }}/Desktop/ONOS GUI.desktop"
196 create: yes
197 owner: "{{ item.value.user }}"
198 group: "{{ item.value.user }}"
199 mode: 0777
200 block: |
201 [Desktop Entry]
202 Encoding=UTF-8
203 Type=Application
204 Name=ONOS GUI
205 Name[en_US]=ONOS GUI
206 Icon=internet-web-browser
207 Exec=/usr/bin/google-chrome-stable http://{{ lxc.lxc_one.ip }}:8181/onos/ui/index.html#topo
208 Comment[en_US]=
209 with_dict: "{{ tutorials }}"
210
211- name: Creating IntelliJ Desktop icons
212 blockinfile:
213 dest: "/home/{{ item.value.user }}/Desktop/IntelliJ.desktop"
214 create: yes
215 owner: "{{ item.value.user }}"
216 group: "{{ item.value.user }}"
217 mode: 0777
218 block: |
219 [Desktop Entry]
220 Encoding=UTF-8
221 Type=Application
222 Name=IntelliJ
223 Name[en_US]=IntelliJ
224 Icon=/home/ubuntu/{{ app_dir }}/{{ intellij.dir_name }}/bin/idea.png
225 Exec=/home/ubuntu/{{ app_dir }}/{{ intellij.dir_name }}/bin/idea.sh
226 Comment[en_US]=
227 with_dict: "{{ tutorials }}"
228
229- name: Creating Wireshark Desktop icons
230 blockinfile:
231 dest: "/home/{{ item.value.user }}/Desktop/Wireshark.desktop"
232 create: yes
233 owner: "{{ item.value.user }}"
234 group: "{{ item.value.user }}"
235 mode: 0777
236 block: |
237 [Desktop Entry]
238 Encoding=UTF-8
239 Type=Application
240 Name=Wireshark
241 Name[en_US]=Wireshark
242 Icon=wireshark
243 Exec=/usr/bin/wireshark
244 Comment[en_US]=
245 with_dict: "{{ tutorials }}"
246
247- name: Creating Terminal Desktop icon
248 blockinfile:
249 dest: "/home/{{ item.value.user }}/Desktop/Terminal.desktop"
250 create: yes
251 owner: "{{ item.value.user }}"
252 group: "{{ item.value.user }}"
253 mode: 0777
254 block: |
255 [Desktop Entry]
256 Encoding=UTF-8
257 Type=Application
258 Name=Terminal
259 Name[en_US]=Terminal
260 Icon=konsole
261 Exec=/bin/bash
262 Comment[en_US]=
263 Terminal=true
264 X-KeepTerminal=true
265 with_dict: "{{ tutorials }}"
266
267- name: Creating Reset Desktop icon
268 blockinfile:
269 dest: "/home/{{ item.value.user }}/Desktop/Reset.desktop"
270 create: yes
271 owner: "{{ item.value.user }}"
272 group: "{{ item.value.user }}"
273 mode: 0777
274 block: |
275 [Desktop Entry]
276 Encoding=UTF-8
277 Type=Application
278 Name=Reset
279 Name[en_US]=Reset
280 Icon=konsole
281 Exec={{ item.value.reset_exec }}
282 Comment[en_US]=
283 Terminal=true
284 X-KeepTerminal=true
285 with_dict: "{{ tutorials }}"