[ONOS-7668] Fix ansible scripts for Vagrant tutorial VM.

Change-Id: I8e063a0ef00c57c092b81eca6ac551964eba6372
diff --git a/tools/dev/vagrant/ansible/roles/intellij-install/tasks/main.yml b/tools/dev/vagrant/ansible/roles/intellij-install/tasks/main.yml
index 2b74f4a..b9d7ca9 100644
--- a/tools/dev/vagrant/ansible/roles/intellij-install/tasks/main.yml
+++ b/tools/dev/vagrant/ansible/roles/intellij-install/tasks/main.yml
@@ -7,6 +7,8 @@
     path: "/home/ubuntu/{{ app_dir }}"
     state: directory
     mode: 0777
+    owner: ubuntu
+    group: ubuntu
 
 - name: Downloading IntelliJ
   get_url:
@@ -18,8 +20,19 @@
     src: "/home/ubuntu/{{ app_dir }}/intellij.tar.gz"
     dest: "/home/ubuntu/{{ app_dir }}"
     mode: 0777
+    owner: ubuntu
+    group: ubuntu
+
+- name: Setting IntelliJ directory permissions
+  file:
+    path: "/home/ubuntu/{{ app_dir }}/{{ intellij.dir_name }}"
+    state: directory
+    mode: 0755
+    owner: ubuntu
+    group: ubuntu
+    recurse: yes
 
 - name: Removing IntelliJ tar.gz archive
   file:
     path: "/home/ubuntu/{{ app_dir }}/intellij.tar.gz"
-    state: absent
\ No newline at end of file
+    state: absent
diff --git a/tools/dev/vagrant/ansible/roles/tutorial-common/tasks/main.yml b/tools/dev/vagrant/ansible/roles/tutorial-common/tasks/main.yml
index 6ef9430..cf69af9 100644
--- a/tools/dev/vagrant/ansible/roles/tutorial-common/tasks/main.yml
+++ b/tools/dev/vagrant/ansible/roles/tutorial-common/tasks/main.yml
@@ -126,6 +126,8 @@
   file:
     path: "/home/{{ item.value.user }}/Desktop"
     state: directory
+    owner: "{{ item.value.user }}"
+    group: "{{ item.value.user }}"
     mode: 0755
   with_dict: "{{ tutorials }}"
 
@@ -279,4 +281,4 @@
       Comment[en_US]=
       Terminal=true
       X-KeepTerminal=true
-  with_dict: "{{ tutorials }}"
\ No newline at end of file
+  with_dict: "{{ tutorials }}"
diff --git a/tools/dev/vagrant/ansible/roles/tutorial-distributed/tasks/main.yml b/tools/dev/vagrant/ansible/roles/tutorial-distributed/tasks/main.yml
index db25426..e2d5011 100644
--- a/tools/dev/vagrant/ansible/roles/tutorial-distributed/tasks/main.yml
+++ b/tools/dev/vagrant/ansible/roles/tutorial-distributed/tasks/main.yml
@@ -6,4 +6,14 @@
   git:
     repo: "{{ tutorials.distributed.byon_app_repo_url }}"
     dest: "/home/{{ tutorials.distributed.user }}/onos-byon"
-    version: "{{ tutorials.distributed.byon_app_version }}"
\ No newline at end of file
+  # Check out master version
+  # version: "{{ tutorials.distributed.byon_app_version }}"
+
+- name: Setting byon app directory permissions
+  file:
+    path: "/home/{{ tutorials.distributed.user }}/onos-byon"
+    state: directory
+    mode: 0777
+    owner: "{{ tutorials.distributed.user }}"
+    group: "{{ tutorials.distributed.user }}"
+    recurse: yes
diff --git a/tools/dev/vagrant/ansible/roles/tutorial-optical/tasks/main.yml b/tools/dev/vagrant/ansible/roles/tutorial-optical/tasks/main.yml
index 9ff2d6b..f21d2e0 100644
--- a/tools/dev/vagrant/ansible/roles/tutorial-optical/tasks/main.yml
+++ b/tools/dev/vagrant/ansible/roles/tutorial-optical/tasks/main.yml
@@ -25,6 +25,8 @@
     src: "/home/ubuntu/{{ app_dir }}/otp_src_{{ tutorials.optical.erlang.version }}.tar.gz"
     dest: "/home/ubuntu/{{ app_dir }}"
     mode: 0777
+    owner: ubuntu
+    group: ubuntu
 
 - name: Configuring ERLANG installation
   shell: "{{ item }}"
@@ -32,6 +34,8 @@
     chdir: "/home/ubuntu/{{ app_dir }}/otp_src_{{ tutorials.optical.erlang.version }}"
   with_items:
     - ./configure
+  become: yes
+  become_user: ubuntu
 
 - name: Installing ERLANG
   become: yes
@@ -52,7 +56,8 @@
 - name: Cloning LINC-OE repositories
   git:
     repo: "{{ item.value.url }}"
-    dest: "{{ item.value.dest }}"
+    dest: "/home/ubuntu/{{ item.value.dest }}"
+    clone: yes
   with_dict: "{{ tutorials.optical.linc_oe }}"
 
 - name: Setting LINC-OE directory permissions
@@ -60,12 +65,17 @@
     path: "/home/ubuntu/{{ item.value.dest }}"
     state: directory
     mode: 0777
+    owner: ubuntu
+    group: ubuntu
+    recurse: yes
   with_dict: "{{ tutorials.optical.linc_oe }}"
 
 - name: Configuring LINC-OE traffic generator
   copy:
     src: "/home/ubuntu/{{ tutorials.optical.linc_oe.config_generator.dest }}/priv/{{ item }}"
     dest: "/home/ubuntu/{{ tutorials.optical.linc_oe.config_generator.dest }}/"
+    owner: ubuntu
+    group: ubuntu
     mode: 0777
   with_items:
     - "json_example.json"
@@ -81,6 +91,8 @@
   copy:
     src: "/home/ubuntu/{{ tutorials.optical.linc_oe.switch.dest }}/rel/files/sys.config.orig"
     dest: "/home/ubuntu/{{ tutorials.optical.linc_oe.switch.dest }}/rel/files/sys.config"
+    owner: ubuntu
+    group: ubuntu
     mode: 0777
 
 - name: Compiling LINC-OE
@@ -93,6 +105,9 @@
     path: "/home/ubuntu/{{ item.value.dest }}"
     state: directory
     mode: 0777
+    owner: ubuntu
+    group: ubuntu
+    recurse: yes
   with_dict: "{{ tutorials.optical.linc_oe }}"
 
 - name: Creating LINC-OE Desktop icons
@@ -110,4 +125,4 @@
       Name[en_US]=LINC-OE
       Icon=konsole
       Exec=gnome-terminal -x bash -c "{{ tutorials.optical.lincoe_exec  }}; exec $SHELL"
-      Comment[en_US]=
\ No newline at end of file
+      Comment[en_US]=
diff --git a/tools/dev/vagrant/ansible/roles/wireshark-custom/tasks/main.yml b/tools/dev/vagrant/ansible/roles/wireshark-custom/tasks/main.yml
index d6aa38b..ab11a80 100644
--- a/tools/dev/vagrant/ansible/roles/wireshark-custom/tasks/main.yml
+++ b/tools/dev/vagrant/ansible/roles/wireshark-custom/tasks/main.yml
@@ -9,5 +9,7 @@
 - name: Downloading most recent openflow.lua wireshark plugin
   get_url:
     url: "{{ wireshark.of_lua_url }}"
-    dest: /home/ubuntu
-    mode: 0777
\ No newline at end of file
+    dest: /home/ubuntu/openflow.lua
+    mode: 0644
+    owner: ubuntu
+    group: ubuntu
diff --git a/tools/dev/vagrant/ansible/vars/global_vars.yml b/tools/dev/vagrant/ansible/vars/global_vars.yml
index c54f130..cba95ef 100644
--- a/tools/dev/vagrant/ansible/vars/global_vars.yml
+++ b/tools/dev/vagrant/ansible/vars/global_vars.yml
@@ -46,7 +46,7 @@
 # ONOS
 onos_repo_url: "https://gerrit.onosproject.org/onos"
 onos_dir: "/home/ubuntu/onos"
-onos_version: "1.9"
+onos_version: "1.13"
 onos_nic: "10.100.198.*"
 onos_variables:
   - "export ONOS_ROOT=~/onos"
@@ -80,8 +80,8 @@
 
 # IDEs configuration
 intellij:
-  dir_name: "idea-IC-171.3780.107"
-  url: "https://download.jetbrains.com/idea/ideaIC-2017.1.tar.gz"
+  dir_name: "idea-IC-173.4674.33"
+  url: "https://download.jetbrains.com/idea/ideaIC-2017.3.5.tar.gz"
 
 # Tutorials configuration
 tutorials: