blob: f21d2e0f3cafe4719b0cd85245a00ecda83556b2 [file] [log] [blame]
Luca Prete8d4e8bc2016-08-24 14:49:54 -07001---
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 Preted8d82312017-03-23 10:26:16 -070012- name: Making sure Application folder is present
13 file:
14 path: "/home/ubuntu/{{ app_dir }}"
15 state: directory
16 mode: 0777
17
Luca Prete8d4e8bc2016-08-24 14:49:54 -070018- name: Downloading ERLANG package
19 get_url:
20 url: "{{ tutorials.optical.erlang.package_url }}"
Luca Preted8d82312017-03-23 10:26:16 -070021 dest: "/home/ubuntu/{{ app_dir }}"
Luca Prete8d4e8bc2016-08-24 14:49:54 -070022
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 Tangbec14852018-05-10 22:55:58 +080028 owner: ubuntu
29 group: ubuntu
Luca Prete8d4e8bc2016-08-24 14:49:54 -070030
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 Tangbec14852018-05-10 22:55:58 +080037 become: yes
38 become_user: ubuntu
Luca Prete8d4e8bc2016-08-24 14:49:54 -070039
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 Tangbec14852018-05-10 22:55:58 +080059 dest: "/home/ubuntu/{{ item.value.dest }}"
60 clone: yes
Luca Prete8d4e8bc2016-08-24 14:49:54 -070061 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 Tangbec14852018-05-10 22:55:58 +080068 owner: ubuntu
69 group: ubuntu
70 recurse: yes
Luca Prete8d4e8bc2016-08-24 14:49:54 -070071 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 Tangbec14852018-05-10 22:55:58 +080077 owner: ubuntu
78 group: ubuntu
Luca Prete8d4e8bc2016-08-24 14:49:54 -070079 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 Tangbec14852018-05-10 22:55:58 +080094 owner: ubuntu
95 group: ubuntu
Luca Prete8d4e8bc2016-08-24 14:49:54 -070096 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 Tangbec14852018-05-10 22:55:58 +0800108 owner: ubuntu
109 group: ubuntu
110 recurse: yes
Luca Prete8d4e8bc2016-08-24 14:49:54 -0700111 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 Tangbec14852018-05-10 22:55:58 +0800128 Comment[en_US]=