blob: 6ef94302c1ac7ab7c63c5d5e0e74a3a0bc9cfe7e [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
129 mode: 0755
130 with_dict: "{{ tutorials }}"
131
132- name: Creating ONOS CLI Desktop icons
133 blockinfile:
134 dest: "/home/{{ item.value.user }}/Desktop/ONOS CLI.desktop"
135 create: yes
136 owner: "{{ item.value.user }}"
137 group: "{{ item.value.user }}"
138 mode: 0777
139 block: |
140 [Desktop Entry]
141 Encoding=UTF-8
142 Type=Application
143 Name=ONOS
144 Name[en_US]=ONOS
145 Icon=konsole
146 Exec=/home/ubuntu/run_onos.sh
147 Comment[en_US]=
148 Terminal=true
149 X-KeepTerminal=true
150 with_dict: "{{ tutorials }}"
151
152- name: Creating Mininet Desktop icon
153 blockinfile:
154 dest: "/home/{{ item.value.user }}/Desktop/Mininet.desktop"
155 create: yes
156 owner: "{{ item.value.user }}"
157 group: "{{ item.value.user }}"
158 mode: 0777
159 block: |
160 [Desktop Entry]
161 Encoding=UTF-8
162 Type=Application
163 Name=Mininet
164 Name[en_US]=Mininet
165 Icon=konsole
166 Exec={{ item.value.mininet_exec }}
167 Comment[en_US]=
168 Terminal=true
169 X-KeepTerminal=true
170 with_dict: "{{ tutorials }}"
171
172- name: Creating Tutorial Desktop icons
173 blockinfile:
174 dest: "/home/{{ item.value.user }}/Desktop/Tutorial.desktop"
175 create: yes
176 owner: "{{ item.value.user }}"
177 group: "{{ item.value.user }}"
178 mode: 0777
179 block: |
180 [Desktop Entry]
181 Encoding=UTF-8
182 Type=Application
183 Name=ONOS Tutorial
184 Name[en_US]=ONOS Tutorial
185 Icon=internet-web-browser
186 Exec=/usr/bin/google-chrome-stable {{ item.value.url }}
187 Comment[en_US]=
188 with_dict: "{{ tutorials }}"
189
190- name: Creating GUI Desktop icons
191 blockinfile:
192 dest: "/home/{{ item.value.user }}/Desktop/ONOS GUI.desktop"
193 create: yes
194 owner: "{{ item.value.user }}"
195 group: "{{ item.value.user }}"
196 mode: 0777
197 block: |
198 [Desktop Entry]
199 Encoding=UTF-8
200 Type=Application
201 Name=ONOS GUI
202 Name[en_US]=ONOS GUI
203 Icon=internet-web-browser
204 Exec=/usr/bin/google-chrome-stable http://{{ lxc.lxc_one.ip }}:8181/onos/ui/index.html#topo
205 Comment[en_US]=
206 with_dict: "{{ tutorials }}"
207
208- name: Creating IntelliJ Desktop icons
209 blockinfile:
210 dest: "/home/{{ item.value.user }}/Desktop/IntelliJ.desktop"
211 create: yes
212 owner: "{{ item.value.user }}"
213 group: "{{ item.value.user }}"
214 mode: 0777
215 block: |
216 [Desktop Entry]
217 Encoding=UTF-8
218 Type=Application
219 Name=IntelliJ
220 Name[en_US]=IntelliJ
221 Icon=/home/ubuntu/{{ app_dir }}/{{ intellij.dir_name }}/bin/idea.png
222 Exec=/home/ubuntu/{{ app_dir }}/{{ intellij.dir_name }}/bin/idea.sh
223 Comment[en_US]=
224 with_dict: "{{ tutorials }}"
225
226- name: Creating Wireshark Desktop icons
227 blockinfile:
228 dest: "/home/{{ item.value.user }}/Desktop/Wireshark.desktop"
229 create: yes
230 owner: "{{ item.value.user }}"
231 group: "{{ item.value.user }}"
232 mode: 0777
233 block: |
234 [Desktop Entry]
235 Encoding=UTF-8
236 Type=Application
237 Name=Wireshark
238 Name[en_US]=Wireshark
239 Icon=wireshark
240 Exec=/usr/bin/wireshark
241 Comment[en_US]=
242 with_dict: "{{ tutorials }}"
243
244- name: Creating Terminal Desktop icon
245 blockinfile:
246 dest: "/home/{{ item.value.user }}/Desktop/Terminal.desktop"
247 create: yes
248 owner: "{{ item.value.user }}"
249 group: "{{ item.value.user }}"
250 mode: 0777
251 block: |
252 [Desktop Entry]
253 Encoding=UTF-8
254 Type=Application
255 Name=Terminal
256 Name[en_US]=Terminal
257 Icon=konsole
258 Exec=/bin/bash
259 Comment[en_US]=
260 Terminal=true
261 X-KeepTerminal=true
262 with_dict: "{{ tutorials }}"
263
264- name: Creating Reset Desktop icon
265 blockinfile:
266 dest: "/home/{{ item.value.user }}/Desktop/Reset.desktop"
267 create: yes
268 owner: "{{ item.value.user }}"
269 group: "{{ item.value.user }}"
270 mode: 0777
271 block: |
272 [Desktop Entry]
273 Encoding=UTF-8
274 Type=Application
275 Name=Reset
276 Name[en_US]=Reset
277 Icon=konsole
278 Exec={{ item.value.reset_exec }}
279 Comment[en_US]=
280 Terminal=true
281 X-KeepTerminal=true
282 with_dict: "{{ tutorials }}"