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