blob: 89a705cb1bdd6db0fc7320b94660296645e477f6 [file] [log] [blame]
Luca Prete8d4e8bc2016-08-24 14:49:54 -07001---
2#
Luca Preted8d82312017-03-23 10:26:16 -07003# Installs ONOS and downloads the related dependencies.
Luca Prete8d4e8bc2016-08-24 14:49:54 -07004#
Luca Prete8d4e8bc2016-08-24 14:49:54 -07005- name: Cloning ONOS repository
6 git:
7 repo: "{{ onos_repo_url }}"
Luca Preted8d82312017-03-23 10:26:16 -07008 dest: "{{ onos_dir }}"
9 version: "onos-{{ onos_version }}"
Luca Prete8d4e8bc2016-08-24 14:49:54 -070010
11- name: Changing ONOS repository permissions
12 file:
13 path: "/home/ubuntu/onos"
14 state: directory
15 owner: ubuntu
16 group: ubuntu
17 mode: 0777
Eric Tang49c291d2018-04-29 14:16:08 +080018 recurse: yes
Luca Prete8d4e8bc2016-08-24 14:49:54 -070019
20- name: Exporting ONOS variables
21 lineinfile:
22 dest: /home/ubuntu/.bashrc
23 line: "{{ item }}"
24 with_items: "{{ onos_variables }}"
25
26- name: Compiling ONOS
27 shell: "{{ item }}"
Eric Tang49c291d2018-04-29 14:16:08 +080028 environment:
29 ONOS_ROOT: /home/ubuntu/onos
Luca Prete8d4e8bc2016-08-24 14:49:54 -070030 args:
Luca Preted8d82312017-03-23 10:26:16 -070031 chdir: "/home/ubuntu/onos/tools/build"
Eric Tang49c291d2018-04-29 14:16:08 +080032 become: yes
33 become_user: ubuntu
Luca Prete8d4e8bc2016-08-24 14:49:54 -070034 with_items:
Luca Preted8d82312017-03-23 10:26:16 -070035 - "./onos-buck build onos"
Luca Prete8d4e8bc2016-08-24 14:49:54 -070036
37- name: Creating 1 node ONOS cell
38 template:
39 src: templates/one_node_cell.j2
40 dest: "{{ cell_files[0] }}"
41 owner: ubuntu
42 group: ubuntu
43 mode: 0777
44
45- name: Creating 3 node ONOS cell
46 template:
47 src: templates/three_node_cell.j2
48 dest: "{{ cell_files[1] }}"
49 owner: ubuntu
50 group: ubuntu
51 mode: 0777
52
53- name: Creating ONOS deployment script
54 template:
55 src: templates/onos_deploy.j2
56 dest: "/home/ubuntu/onos_deploy.sh"
57 owner: ubuntu
58 group: ubuntu
59 mode: 0777
60
Luca Preted8d82312017-03-23 10:26:16 -070061- name: Changing ONOS repository permissions
62 file:
63 path: "/home/ubuntu/onos"
64 state: directory
65 owner: ubuntu
66 group: ubuntu
67 mode: 0777
68
69- name: Changing /tmp/stc dir permissions
70 file:
71 path: "/tmp/stc"
72 state: directory
73 owner: ubuntu
74 group: ubuntu
75 mode: 0777
76
Luca Prete8d4e8bc2016-08-24 14:49:54 -070077- name: Deploying ONOS
Luca Preted8d82312017-03-23 10:26:16 -070078 become: yes
79 become_user: ubuntu
Luca Prete8d4e8bc2016-08-24 14:49:54 -070080 shell: "/home/ubuntu/onos_deploy.sh"
81 environment:
82 ONOS_ROOT: /home/ubuntu/onos
83 args:
84 executable: /bin/bash
Luca Prete8d4e8bc2016-08-24 14:49:54 -070085
86- name: Adding ONOS to startup
87 become: yes
88 shell: "lxc-attach --name {{ item.value.name }} -- systemctl enable onos"
Eric Tang49c291d2018-04-29 14:16:08 +080089 with_dict: "{{ lxc }}"