blob: cf69af9076a8f330461f10967b43b943c9addba3 [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
Luca Prete8d4e8bc2016-08-24 14:49:54 -070078 . /home/ubuntu/onos/tools/dev/bash_profile
79 cell {{ item.value.cell }} > /dev/null
80 with_dict: "{{ tutorials }}"
81
82- name: Creating .wireshark folders
83 file:
84 path: "/home/{{ item.value.user }}/{{ wireshark.plugins_dir }}"
85 state: directory
86 owner: "{{ item.value.user }}"
87 group: "{{ item.value.user }}"
88 mode: 0755
89 with_dict: "{{ tutorials }}"
90
91- name: Copying openflow.lua Wireshark plugin
92 copy:
93 src: "/home/ubuntu/openflow.lua"
94 dest: "/home/{{ item.value.user }}/{{ wireshark.plugins_dir }}"
95 owner: "{{ item.value.user }}"
96 group: "{{ item.value.user }}"
97 with_dict: "{{ tutorials }}"
98
99- name: Creating run_onos.sh script
100 template:
101 src: templates/run_onos.j2
102 dest: /home/ubuntu/run_onos.sh
103 owner: ubuntu
104 group: ubuntu
105 mode: 0777
106
107- name: Creating config Desktop folder
108 file:
109 path: "/home/{{ item.value.user }}/.config/pcmanfm/lubuntu/"
110 state: directory
111 owner: "{{ item.value.user }}"
112 group: "{{ item.value.user }}"
113 mode: 0777
114 with_dict: "{{ tutorials }}"
115
116- name: Loading ONOS Desktop background
117 template:
118 src: templates/gui_custom.j2
119 dest: "/home/{{ item.value.user }}/.config/pcmanfm/lubuntu/desktop-items-0.conf"
120 owner: "{{ item.value.user }}"
121 group: "{{ item.value.user }}"
122 mode: 0777
123 with_dict: "{{ tutorials }}"
124
125- name: Creating Desktop folders
126 file:
127 path: "/home/{{ item.value.user }}/Desktop"
128 state: directory
Eric Tangbec14852018-05-10 22:55:58 +0800129 owner: "{{ item.value.user }}"
130 group: "{{ item.value.user }}"
Luca Prete8d4e8bc2016-08-24 14:49:54 -0700131 mode: 0755
132 with_dict: "{{ tutorials }}"
133
134- name: Creating ONOS CLI Desktop icons
135 blockinfile:
136 dest: "/home/{{ item.value.user }}/Desktop/ONOS CLI.desktop"
137 create: yes
138 owner: "{{ item.value.user }}"
139 group: "{{ item.value.user }}"
140 mode: 0777
141 block: |
142 [Desktop Entry]
143 Encoding=UTF-8
144 Type=Application
145 Name=ONOS
146 Name[en_US]=ONOS
147 Icon=konsole
148 Exec=/home/ubuntu/run_onos.sh
149 Comment[en_US]=
150 Terminal=true
151 X-KeepTerminal=true
152 with_dict: "{{ tutorials }}"
153
154- name: Creating Mininet Desktop icon
155 blockinfile:
156 dest: "/home/{{ item.value.user }}/Desktop/Mininet.desktop"
157 create: yes
158 owner: "{{ item.value.user }}"
159 group: "{{ item.value.user }}"
160 mode: 0777
161 block: |
162 [Desktop Entry]
163 Encoding=UTF-8
164 Type=Application
165 Name=Mininet
166 Name[en_US]=Mininet
167 Icon=konsole
168 Exec={{ item.value.mininet_exec }}
169 Comment[en_US]=
170 Terminal=true
171 X-KeepTerminal=true
172 with_dict: "{{ tutorials }}"
173
174- name: Creating Tutorial Desktop icons
175 blockinfile:
176 dest: "/home/{{ item.value.user }}/Desktop/Tutorial.desktop"
177 create: yes
178 owner: "{{ item.value.user }}"
179 group: "{{ item.value.user }}"
180 mode: 0777
181 block: |
182 [Desktop Entry]
183 Encoding=UTF-8
184 Type=Application
185 Name=ONOS Tutorial
186 Name[en_US]=ONOS Tutorial
187 Icon=internet-web-browser
188 Exec=/usr/bin/google-chrome-stable {{ item.value.url }}
189 Comment[en_US]=
190 with_dict: "{{ tutorials }}"
191
192- name: Creating GUI Desktop icons
193 blockinfile:
194 dest: "/home/{{ item.value.user }}/Desktop/ONOS GUI.desktop"
195 create: yes
196 owner: "{{ item.value.user }}"
197 group: "{{ item.value.user }}"
198 mode: 0777
199 block: |
200 [Desktop Entry]
201 Encoding=UTF-8
202 Type=Application
203 Name=ONOS GUI
204 Name[en_US]=ONOS GUI
205 Icon=internet-web-browser
206 Exec=/usr/bin/google-chrome-stable http://{{ lxc.lxc_one.ip }}:8181/onos/ui/index.html#topo
207 Comment[en_US]=
208 with_dict: "{{ tutorials }}"
209
210- name: Creating IntelliJ Desktop icons
211 blockinfile:
212 dest: "/home/{{ item.value.user }}/Desktop/IntelliJ.desktop"
213 create: yes
214 owner: "{{ item.value.user }}"
215 group: "{{ item.value.user }}"
216 mode: 0777
217 block: |
218 [Desktop Entry]
219 Encoding=UTF-8
220 Type=Application
221 Name=IntelliJ
222 Name[en_US]=IntelliJ
223 Icon=/home/ubuntu/{{ app_dir }}/{{ intellij.dir_name }}/bin/idea.png
224 Exec=/home/ubuntu/{{ app_dir }}/{{ intellij.dir_name }}/bin/idea.sh
225 Comment[en_US]=
226 with_dict: "{{ tutorials }}"
227
228- name: Creating Wireshark Desktop icons
229 blockinfile:
230 dest: "/home/{{ item.value.user }}/Desktop/Wireshark.desktop"
231 create: yes
232 owner: "{{ item.value.user }}"
233 group: "{{ item.value.user }}"
234 mode: 0777
235 block: |
236 [Desktop Entry]
237 Encoding=UTF-8
238 Type=Application
239 Name=Wireshark
240 Name[en_US]=Wireshark
241 Icon=wireshark
242 Exec=/usr/bin/wireshark
243 Comment[en_US]=
244 with_dict: "{{ tutorials }}"
245
246- name: Creating Terminal Desktop icon
247 blockinfile:
248 dest: "/home/{{ item.value.user }}/Desktop/Terminal.desktop"
249 create: yes
250 owner: "{{ item.value.user }}"
251 group: "{{ item.value.user }}"
252 mode: 0777
253 block: |
254 [Desktop Entry]
255 Encoding=UTF-8
256 Type=Application
257 Name=Terminal
258 Name[en_US]=Terminal
259 Icon=konsole
260 Exec=/bin/bash
261 Comment[en_US]=
262 Terminal=true
263 X-KeepTerminal=true
264 with_dict: "{{ tutorials }}"
265
266- name: Creating Reset Desktop icon
267 blockinfile:
268 dest: "/home/{{ item.value.user }}/Desktop/Reset.desktop"
269 create: yes
270 owner: "{{ item.value.user }}"
271 group: "{{ item.value.user }}"
272 mode: 0777
273 block: |
274 [Desktop Entry]
275 Encoding=UTF-8
276 Type=Application
277 Name=Reset
278 Name[en_US]=Reset
279 Icon=konsole
280 Exec={{ item.value.reset_exec }}
281 Comment[en_US]=
282 Terminal=true
283 X-KeepTerminal=true
Eric Tangbec14852018-05-10 22:55:58 +0800284 with_dict: "{{ tutorials }}"