Zack Williams | fc102dd | 2016-03-01 17:31:30 -0700 | [diff] [blame] | 1 | --- |
| 2 | # tasks for xos-install role |
| 3 | |
Scott Baker | db5c8c7 | 2016-11-08 08:40:06 -0800 | [diff] [blame] | 4 | - name: Install prerequisites |
| 5 | apt: |
| 6 | name={{ item }} |
| 7 | update_cache=yes |
| 8 | cache_valid_time=3600 |
| 9 | become: yes |
| 10 | with_items: |
| 11 | - git |
| 12 | - make |
| 13 | - curl |
| 14 | - python-novaclient |
| 15 | - python-neutronclient |
| 16 | - python-keystoneclient |
| 17 | - python-glanceclient |
Zack Williams | d2cbe51 | 2016-06-03 09:33:15 -0700 | [diff] [blame] | 18 | |
Scott Baker | db5c8c7 | 2016-11-08 08:40:06 -0800 | [diff] [blame] | 19 | - name: Copy repositories to the head node |
| 20 | synchronize: |
| 21 | src: "{{ playbook_dir }}/../../orchestration/{{ item }}" |
| 22 | dest: "{{ ansible_user_dir }}/" |
Scott Baker | db5c8c7 | 2016-11-08 08:40:06 -0800 | [diff] [blame] | 23 | with_items: |
| 24 | - service-profile |
| 25 | - xos |
| 26 | - xos_libraries |
| 27 | - xos_services |
| 28 | |
| 29 | - name: Check to see if onos_apps directory exists |
| 30 | local_action: stat path="{{ playbook_dir }}/../../onos-apps/apps" |
| 31 | register: onos_apps |
| 32 | |
| 33 | - name: Copy in onos-apps that have XOS code |
| 34 | synchronize: |
| 35 | src: "{{ playbook_dir }}/../../onos-apps/apps/{{ item }}" |
| 36 | dest: "{{ ansible_user_dir }}/xos_services/" |
| 37 | with_items: |
| 38 | - vtn |
| 39 | - olt |
Scott Baker | db5c8c7 | 2016-11-08 08:40:06 -0800 | [diff] [blame] | 40 | |
| 41 | - name: Copy over SSH keys |
| 42 | command: cp ~/.ssh/{{ item }} {{ service_profile_repo_dest }}/{{ xos_configuration }}/ |
| 43 | with_items: |
| 44 | - id_rsa |
| 45 | - id_rsa.pub |
| 46 | tags: |
| 47 | - skip_ansible_lint |
| 48 | |
| 49 | - name: Copy over node key |
| 50 | command: cp {{ ansible_user_dir }}/node_key {{ service_profile_repo_dest }}/{{ xos_configuration }}/ |
| 51 | tags: |
| 52 | - skip_ansible_lint |
| 53 | |
| 54 | - name: Set ownership and permissions of keys |
| 55 | file: |
| 56 | path={{ service_profile_repo_dest }}/{{ xos_configuration }}/{{ item }} |
| 57 | owner={{ ansible_user_id }} |
| 58 | # mode=0600 |
| 59 | with_items: |
| 60 | - id_rsa |
| 61 | - id_rsa.pub |
| 62 | - node_key |
| 63 | |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 64 | - name: Create templated TOSCA files |
| 65 | template: |
| 66 | src: "{{ item }}.j2" |
| 67 | dest: "{{ service_profile_repo_dest }}/{{ xos_configuration }}/{{ item }}" |
| 68 | with_items: "{{ xos_tosca_templates }}" |
Scott Baker | db5c8c7 | 2016-11-08 08:40:06 -0800 | [diff] [blame] | 69 | |
| 70 | - name: Download Glance VM images |
| 71 | get_url: |
| 72 | url={{ item.url }} |
| 73 | checksum={{ item.checksum }} |
Zack Williams | 682450e | 2016-11-19 09:04:41 -0700 | [diff] [blame] | 74 | dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/images/{{ item.name }}.qcow2 |
Scott Baker | db5c8c7 | 2016-11-08 08:40:06 -0800 | [diff] [blame] | 75 | with_items: "{{ xos_images }}" |
| 76 | |
| 77 | # ---- pull docker images ---- |
| 78 | |
| 79 | - name: Check to see if registry is reachable |
| 80 | command: curl -sf http://docker-registry:5000/ |
| 81 | ignore_errors: yes |
| 82 | register: docker_registry_check |
| 83 | tags: |
| 84 | - skip_ansible_lint |
| 85 | |
| 86 | - name: Use registry if it is available |
| 87 | set_fact: |
| 88 | docker_registry: "{{ local_docker_registry }}" |
| 89 | docker_opts: "--insecure-registry {{ local_docker_registry }}" |
| 90 | docker_tag: "candidate" |
| 91 | when: docker_registry_check|succeeded |
| 92 | |
| 93 | - name: Pull docker images for XOS |
| 94 | become: yes |
| 95 | command: docker pull {{ docker_registry }}/{{ item }}:{{ docker_tag }} |
| 96 | with_items: |
| 97 | - xosproject/xos-base |
| 98 | - xosproject/xos-postgres |
| 99 | - xosproject/cord-app-build |
| 100 | - redis |
| 101 | tags: |
| 102 | - skip_ansible_lint |
| 103 | |
| 104 | - name: Tag the images downloaded from the local registry |
| 105 | command: docker tag {{ docker_registry }}/{{ item }}:{{ docker_tag }} {{ item }}:latest |
| 106 | with_items: |
| 107 | - xosproject/xos-base |
| 108 | - xosproject/xos-postgres |
| 109 | - xosproject/cord-app-build |
| 110 | - redis |
| 111 | when: docker_registry_check|succeeded |
| 112 | |
Zack Williams | c563b57 | 2016-06-03 09:49:53 -0700 | [diff] [blame] | 113 | |
Scott Baker | db5c8c7 | 2016-11-08 08:40:06 -0800 | [diff] [blame] | 114 | |
| 115 | |
Zack Williams | d2cbe51 | 2016-06-03 09:33:15 -0700 | [diff] [blame] | 116 | |