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 |
| 18 | |
| 19 | - name: Exporting ONOS variables |
| 20 | lineinfile: |
| 21 | dest: /home/ubuntu/.bashrc |
| 22 | line: "{{ item }}" |
| 23 | with_items: "{{ onos_variables }}" |
| 24 | |
| 25 | - name: Compiling ONOS |
| 26 | shell: "{{ item }}" |
| 27 | args: |
Luca Prete | d8d8231 | 2017-03-23 10:26:16 -0700 | [diff] [blame] | 28 | chdir: "/home/ubuntu/onos/tools/build" |
Luca Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 29 | with_items: |
Luca Prete | d8d8231 | 2017-03-23 10:26:16 -0700 | [diff] [blame] | 30 | - "./onos-buck build onos" |
Luca Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 31 | |
| 32 | - name: Creating 1 node ONOS cell |
| 33 | template: |
| 34 | src: templates/one_node_cell.j2 |
| 35 | dest: "{{ cell_files[0] }}" |
| 36 | owner: ubuntu |
| 37 | group: ubuntu |
| 38 | mode: 0777 |
| 39 | |
| 40 | - name: Creating 3 node ONOS cell |
| 41 | template: |
| 42 | src: templates/three_node_cell.j2 |
| 43 | dest: "{{ cell_files[1] }}" |
| 44 | owner: ubuntu |
| 45 | group: ubuntu |
| 46 | mode: 0777 |
| 47 | |
| 48 | - name: Creating ONOS deployment script |
| 49 | template: |
| 50 | src: templates/onos_deploy.j2 |
| 51 | dest: "/home/ubuntu/onos_deploy.sh" |
| 52 | owner: ubuntu |
| 53 | group: ubuntu |
| 54 | mode: 0777 |
| 55 | |
Luca Prete | d8d8231 | 2017-03-23 10:26:16 -0700 | [diff] [blame] | 56 | - name: Changing ONOS repository permissions |
| 57 | file: |
| 58 | path: "/home/ubuntu/onos" |
| 59 | state: directory |
| 60 | owner: ubuntu |
| 61 | group: ubuntu |
| 62 | mode: 0777 |
| 63 | |
| 64 | - name: Changing /tmp/stc dir permissions |
| 65 | file: |
| 66 | path: "/tmp/stc" |
| 67 | state: directory |
| 68 | owner: ubuntu |
| 69 | group: ubuntu |
| 70 | mode: 0777 |
| 71 | |
Luca Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 72 | - name: Deploying ONOS |
Luca Prete | d8d8231 | 2017-03-23 10:26:16 -0700 | [diff] [blame] | 73 | become: yes |
| 74 | become_user: ubuntu |
Luca Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 75 | shell: "/home/ubuntu/onos_deploy.sh" |
| 76 | environment: |
| 77 | ONOS_ROOT: /home/ubuntu/onos |
| 78 | args: |
| 79 | executable: /bin/bash |
Luca Prete | 8d4e8bc | 2016-08-24 14:49:54 -0700 | [diff] [blame] | 80 | |
| 81 | - name: Adding ONOS to startup |
| 82 | become: yes |
| 83 | shell: "lxc-attach --name {{ item.value.name }} -- systemctl enable onos" |
| 84 | with_dict: "{{ lxc }}" |