Zack Williams | 363bc85 | 2016-04-12 13:58:29 -0700 | [diff] [blame] | 1 | --- |
| 2 | - hosts: onos-cord-1 |
| 3 | remote_user: ubuntu |
| 4 | |
| 5 | tasks: |
| 6 | - name: Include configuration vars |
| 7 | include_vars: onos-setup-vars.yml |
| 8 | |
| 9 | # https://docs.docker.com/engine/installation/linux/ubuntulinux/ |
| 10 | - name: Prereqs and SSL support for apt for SSL |
| 11 | become: yes |
| 12 | apt: |
| 13 | name={{ item }} |
| 14 | update_cache=yes |
| 15 | cache_valid_time=3600 |
| 16 | with_items: |
| 17 | - apt-transport-https |
| 18 | - ca-certificates |
| 19 | - python-pip |
| 20 | |
| 21 | - name: Trust docker apt key |
| 22 | become: yes |
| 23 | apt_key: |
| 24 | keyserver=pool.sks-keyservers.net |
| 25 | id=58118E89F3A912897C070ADBF76221572C52609D |
| 26 | |
| 27 | - name: Add docker apt repo |
| 28 | become: yes |
| 29 | apt_repository: |
| 30 | repo="deb https://apt.dockerproject.org/repo ubuntu-trusty main" |
| 31 | |
| 32 | - name: Install docker |
| 33 | become: yes |
| 34 | apt: |
| 35 | update_cache=yes |
| 36 | cache_valid_time=3600 |
| 37 | name=docker-engine |
| 38 | |
| 39 | - name: Make user part of the Docker group |
| 40 | become: yes |
| 41 | user: |
| 42 | name={{ ansible_user_id }} |
| 43 | groups="docker" append=yes |
| 44 | |
| 45 | # https://docs.docker.com/compose/install/#install-using-pip |
| 46 | - name: Install docker-compose from PyPi |
| 47 | become: yes |
| 48 | pip: |
| 49 | name=docker-compose |
| 50 | |
Zack Williams | 9b3c361 | 2016-04-14 07:05:30 -0700 | [diff] [blame] | 51 | - name: Create CORD directory |
| 52 | file: |
| 53 | path={{ ansible_user_dir }}/cord |
| 54 | state=directory |
| 55 | |
Zack Williams | 363bc85 | 2016-04-12 13:58:29 -0700 | [diff] [blame] | 56 | - name: Copy over SSH keys |
| 57 | copy: |
| 58 | src=~/.ssh/{{ item }} |
| 59 | dest={{ ansible_user_dir }}/cord/{{ item }} |
| 60 | owner={{ ansible_user_id }} mode=0600 |
| 61 | with_items: |
| 62 | - id_rsa |
| 63 | - id_rsa.pub |
| 64 | |
Zack Williams | 2a28709 | 2016-05-18 13:41:31 -0700 | [diff] [blame] | 65 | - name: Copy over files to build XOS variant of ONOS |
| 66 | copy: |
| 67 | src="~/{{ item }}" |
| 68 | dest="{{ ansible_user_dir }}/cord/{{ item }}" |
| 69 | with_items: |
| 70 | - Dockerfile.xos-onos |
| 71 | - onos-service |
| 72 | |
Zack Williams | 363bc85 | 2016-04-12 13:58:29 -0700 | [diff] [blame] | 73 | - name: Copy over docker-compose.yml files |
| 74 | copy: |
Zack Williams | 2a28709 | 2016-05-18 13:41:31 -0700 | [diff] [blame] | 75 | src=~/onos-docker-compose.yml |
Zack Williams | 363bc85 | 2016-04-12 13:58:29 -0700 | [diff] [blame] | 76 | dest={{ ansible_user_dir }}/cord/docker-compose.yml |
| 77 | |
Zack Williams | b693073 | 2016-05-20 15:12:36 -0700 | [diff] [blame] | 78 | # The become here is to work around user not being in the docker group |
| 79 | # until the next login, so become it again to reload group membership |
Zack Williams | d31bbc9 | 2016-05-20 11:43:18 -0700 | [diff] [blame] | 80 | - name: Pull docker image for ONOS |
Zack Williams | ce42214 | 2016-05-20 14:18:22 -0700 | [diff] [blame] | 81 | become: yes |
Zack Williams | 40a4fa6 | 2016-05-20 15:16:10 -0700 | [diff] [blame^] | 82 | become_user: "{{ ansible_user_id }}" |
Zack Williams | d31bbc9 | 2016-05-20 11:43:18 -0700 | [diff] [blame] | 83 | command: docker pull onosproject/onos |
| 84 | |