Zack Williams | 6f5a6e7 | 2016-08-10 17:45:27 -0700 | [diff] [blame] | 1 | --- |
| 2 | - hosts: xos-1 |
| 3 | remote_user: ubuntu |
| 4 | |
| 5 | tasks: |
| 6 | - name: Include configuration vars |
| 7 | include_vars: xos-setup-vars.yml |
| 8 | |
| 9 | - name: Install prerequisites |
| 10 | apt: |
| 11 | name={{ item }} |
| 12 | update_cache=yes |
| 13 | cache_valid_time=3600 |
| 14 | become: yes |
| 15 | with_items: |
| 16 | - git |
| 17 | - make |
| 18 | - curl |
| 19 | - python-novaclient |
| 20 | - python-neutronclient |
| 21 | - python-keystoneclient |
| 22 | - python-glanceclient |
| 23 | |
| 24 | - name: Clone XOS repo |
| 25 | git: |
| 26 | repo={{ xos_repo_url }} |
| 27 | dest={{ xos_repo_dest }} |
| 28 | version={{ xos_repo_branch }} |
| 29 | force=yes |
| 30 | |
| 31 | - name: Clone service-profile repo |
| 32 | git: |
| 33 | repo={{ service_profile_repo_url }} |
| 34 | dest={{ service_profile_repo_dest }} |
| 35 | version={{ service_profile_repo_branch }} |
| 36 | force=yes |
| 37 | |
| 38 | - name: Copy over SSH keys |
| 39 | copy: |
| 40 | src=~/.ssh/{{ item }} |
| 41 | dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/ |
| 42 | owner={{ ansible_user_id }} mode=0600 |
| 43 | with_items: |
| 44 | - id_rsa |
| 45 | - id_rsa.pub |
| 46 | |
| 47 | - name: copy over node_key |
| 48 | copy: |
| 49 | src={{ node_private_key }} |
| 50 | dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/node_key |
| 51 | owner={{ ansible_user_id }} mode=0600 |
| 52 | |
| 53 | - name: Download Glance VM images |
| 54 | get_url: |
| 55 | url={{ item.url }} |
| 56 | checksum={{ item.checksum }} |
| 57 | dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/images/{{ item.name }}.img |
| 58 | with_items: "{{ xos_images }}" |
| 59 | |
| 60 | - name: Pull database image |
| 61 | become: yes |
| 62 | command: docker pull {{ item }} |
| 63 | with_items: |
| 64 | - xosproject/xos-postgres |
| 65 | |
| 66 | - name: Pull docker images for XOS |
| 67 | when: not xos_container_rebuild |
| 68 | become: yes |
| 69 | command: docker pull {{ item }} |
| 70 | with_items: |
| 71 | - xosproject/xos-base |
| 72 | |
| 73 | - name: Rebuild XOS containers |
| 74 | when: xos_container_rebuild |
| 75 | command: make {{ item }} |
| 76 | chdir="{{ xos_repo_dest }}/containers/xos/" |
| 77 | with_items: |
| 78 | - base |