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