Luca Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 1 | --- |
| 2 | # |
| 3 | # Adds optical tutorial specific configurations |
| 4 | # |
| 5 | - name: Installing Prerequisites |
| 6 | apt: |
| 7 | name: "{{ item }}" |
| 8 | force: yes |
| 9 | update_cache: yes |
| 10 | with_items: "{{ tutorials.optical.packages }}" |
| 11 | |
| 12 | - name: Downloading ERLANG package |
| 13 | get_url: |
| 14 | url: "{{ tutorials.optical.erlang.package_url }}" |
| 15 | dest: "{{ app_dir }}" |
| 16 | |
| 17 | - name: Extracting ERLANG package |
| 18 | unarchive: |
| 19 | src: "/home/ubuntu/{{ app_dir }}/otp_src_{{ tutorials.optical.erlang.version }}.tar.gz" |
| 20 | dest: "/home/ubuntu/{{ app_dir }}" |
| 21 | mode: 0777 |
| 22 | |
| 23 | - name: Configuring ERLANG installation |
| 24 | shell: "{{ item }}" |
| 25 | args: |
| 26 | chdir: "/home/ubuntu/{{ app_dir }}/otp_src_{{ tutorials.optical.erlang.version }}" |
| 27 | with_items: |
| 28 | - ./configure |
| 29 | |
| 30 | - name: Installing ERLANG |
| 31 | become: yes |
| 32 | make: |
| 33 | chdir: "/home/ubuntu/{{ app_dir }}/otp_src_{{ tutorials.optical.erlang.version }}" |
| 34 | target: install |
| 35 | |
| 36 | - name: Removing ERLANG tar.gz |
| 37 | file: |
| 38 | path: "/home/ubuntu/{{ app_dir }}/otp_src_{{ tutorials.optical.erlang.version }}.tar.gz" |
| 39 | state: absent |
| 40 | |
| 41 | - name: Removing ERLANG directory |
| 42 | file: |
| 43 | path: "/home/ubuntu/{{ app_dir }}/otp_src_{{ tutorials.optical.erlang.version }}" |
| 44 | state: absent |
| 45 | |
| 46 | - name: Cloning LINC-OE repositories |
| 47 | git: |
| 48 | repo: "{{ item.value.url }}" |
| 49 | dest: "{{ item.value.dest }}" |
| 50 | with_dict: "{{ tutorials.optical.linc_oe }}" |
| 51 | |
| 52 | - name: Setting LINC-OE directory permissions |
| 53 | file: |
| 54 | path: "/home/ubuntu/{{ item.value.dest }}" |
| 55 | state: directory |
| 56 | mode: 0777 |
| 57 | with_dict: "{{ tutorials.optical.linc_oe }}" |
| 58 | |
| 59 | - name: Configuring LINC-OE traffic generator |
| 60 | copy: |
| 61 | src: "/home/ubuntu/{{ tutorials.optical.linc_oe.config_generator.dest }}/priv/{{ item }}" |
| 62 | dest: "/home/ubuntu/{{ tutorials.optical.linc_oe.config_generator.dest }}/" |
| 63 | mode: 0777 |
| 64 | with_items: |
| 65 | - "json_example.json" |
| 66 | - "sys.config.template" |
| 67 | |
| 68 | - name: Configuring LINC-OE switch |
| 69 | replace: |
| 70 | dest: "/home/ubuntu/{{ tutorials.optical.linc_oe.switch.dest }}/rel/files/vm.args" |
| 71 | regexp: 'ERL_MAX_ETS_TABLES 3000' |
| 72 | replace: 'ERL_MAX_ETS_TABLES 300000' |
| 73 | |
| 74 | - name: Applying LINC-OE switch config |
| 75 | copy: |
| 76 | src: "/home/ubuntu/{{ tutorials.optical.linc_oe.switch.dest }}/rel/files/sys.config.orig" |
| 77 | dest: "/home/ubuntu/{{ tutorials.optical.linc_oe.switch.dest }}/rel/files/sys.config" |
| 78 | mode: 0777 |
| 79 | |
| 80 | - name: Compiling LINC-OE |
| 81 | make: |
| 82 | chdir: "/home/ubuntu/{{ item.value.dest }}" |
| 83 | with_dict: "{{ tutorials.optical.linc_oe }}" |
| 84 | |
| 85 | - name: Setting LINC-OE directory permissions |
| 86 | file: |
| 87 | path: "/home/ubuntu/{{ item.value.dest }}" |
| 88 | state: directory |
| 89 | mode: 0777 |
| 90 | with_dict: "{{ tutorials.optical.linc_oe }}" |
| 91 | |
| 92 | - name: Creating LINC-OE Desktop icons |
| 93 | blockinfile: |
| 94 | dest: "/home/{{ tutorials.optical.user }}/Desktop/LINC-OE.desktop" |
| 95 | create: yes |
| 96 | owner: "{{ tutorials.optical.user }}" |
| 97 | group: "{{ tutorials.optical.user }}" |
| 98 | mode: 0777 |
| 99 | block: | |
| 100 | [Desktop Entry] |
| 101 | Encoding=UTF-8 |
| 102 | Type=Application |
| 103 | Name=LINC-OE |
| 104 | Name[en_US]=LINC-OE |
| 105 | Icon=konsole |
| 106 | Exec=gnome-terminal -x bash -c "{{ tutorials.optical.lincoe_exec }}; exec $SHELL" |
| 107 | Comment[en_US]= |