Luca Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 1 | --- |
| 2 | # |
Luca Prete | d8d8231 | 2017-03-23 10:26:16 -0700 | [diff] [blame] | 3 | # Installs ONOS and downloads the related dependencies. |
Luca Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 4 | # |
Luca Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 5 | - name: Cloning ONOS repository |
| 6 | git: |
| 7 | repo: "{{ onos_repo_url }}" |
Luca Prete | d8d8231 | 2017-03-23 10:26:16 -0700 | [diff] [blame] | 8 | dest: "{{ onos_dir }}" |
| 9 | version: "onos-{{ onos_version }}" |
Luca Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 10 | |
| 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 Tang | 49c291d | 2018-04-29 14:16:08 +0800 | [diff] [blame] | 18 | recurse: yes |
Luca Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 19 | |
| 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 Tang | 49c291d | 2018-04-29 14:16:08 +0800 | [diff] [blame] | 28 | environment: |
| 29 | ONOS_ROOT: /home/ubuntu/onos |
Luca Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 30 | args: |
Luca Prete | d8d8231 | 2017-03-23 10:26:16 -0700 | [diff] [blame] | 31 | chdir: "/home/ubuntu/onos/tools/build" |
Eric Tang | 49c291d | 2018-04-29 14:16:08 +0800 | [diff] [blame] | 32 | become: yes |
| 33 | become_user: ubuntu |
Luca Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 34 | with_items: |
Luca Prete | d8d8231 | 2017-03-23 10:26:16 -0700 | [diff] [blame] | 35 | - "./onos-buck build onos" |
Luca Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 36 | |
| 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 Prete | d8d8231 | 2017-03-23 10:26:16 -0700 | [diff] [blame] | 61 | - 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 Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 77 | - name: Deploying ONOS |
Luca Prete | d8d8231 | 2017-03-23 10:26:16 -0700 | [diff] [blame] | 78 | become: yes |
| 79 | become_user: ubuntu |
Luca Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 80 | shell: "/home/ubuntu/onos_deploy.sh" |
| 81 | environment: |
| 82 | ONOS_ROOT: /home/ubuntu/onos |
| 83 | args: |
| 84 | executable: /bin/bash |
Luca Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 85 | |
| 86 | - name: Adding ONOS to startup |
| 87 | become: yes |
| 88 | shell: "lxc-attach --name {{ item.value.name }} -- systemctl enable onos" |
Eric Tang | 49c291d | 2018-04-29 14:16:08 +0800 | [diff] [blame] | 89 | with_dict: "{{ lxc }}" |