blob: cc5b95572f88aeea54a61c1f6da7d20627ba4a7a [file] [log] [blame]
Zack Williams363bc852016-04-12 13:58:29 -07001---
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
Zack Williamse4fbacc2016-05-21 07:18:43 -070018 - curl
Zack Williams363bc852016-04-12 13:58:29 -070019 - python-novaclient
20 - python-neutronclient
21 - python-keystoneclient
22 - python-glanceclient
23
Scott Bakerc2cd1b52016-10-26 08:53:15 -070024 - name: Check to see if xos_install/orchestration directory exists
25 local_action: stat path="{{ playbook_dir }}/xos_install/orchestration"
26 register: orchestration
27
28 # Two methods to install:
29 # 1) If running from cord-in-a-box, then xos_install/orchestration will
30 # be populated with the checked-out xos repositories, and we can
31 # now copy them to the XOS VM.
32 # 2) If not running from cord-in-a-box, then xos_install will not
33 # exist, and we will check out the repos using git.
34
35 - name: Copy repositories to the XOS VM
36 synchronize:
37 src: "{{ playbook_dir }}/xos_install/orchestration/"
38 dest: "{{ orchestration_dest }}"
39 when:
40 orchestration.stat.exists == True
41
Zack Williams363bc852016-04-12 13:58:29 -070042 - name: Clone XOS repo
43 git:
44 repo={{ xos_repo_url }}
45 dest={{ xos_repo_dest }}
46 version={{ xos_repo_branch }}
Zack Williams9b3c3612016-04-14 07:05:30 -070047 force=yes
Scott Bakerc2cd1b52016-10-26 08:53:15 -070048 when:
49 orchestration.stat.exists == False
Zack Williams363bc852016-04-12 13:58:29 -070050
Scott Baker333a3152016-06-29 08:58:42 -070051 - name: Clone service-profile repo
52 git:
53 repo={{ service_profile_repo_url }}
54 dest={{ service_profile_repo_dest }}
55 version={{ service_profile_repo_branch }}
56 force=yes
Scott Bakerc2cd1b52016-10-26 08:53:15 -070057 when:
58 orchestration.stat.exists == False
Scott Baker333a3152016-06-29 08:58:42 -070059
Zack Williams363bc852016-04-12 13:58:29 -070060 - name: Copy over SSH keys
61 copy:
62 src=~/.ssh/{{ item }}
Scott Baker333a3152016-06-29 08:58:42 -070063 dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/
Zack Williams363bc852016-04-12 13:58:29 -070064 owner={{ ansible_user_id }} mode=0600
65 with_items:
66 - id_rsa
67 - id_rsa.pub
68
Andy Bavier6274d6a2016-08-12 18:12:01 -040069 - name: copy over node_key
Zack Williamse4fbacc2016-05-21 07:18:43 -070070 copy:
Andy Bavierd39936c2016-08-02 17:31:07 -040071 src={{ node_private_key }}
Scott Baker333a3152016-06-29 08:58:42 -070072 dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/node_key
Andy Bavier6274d6a2016-08-12 18:12:01 -040073 owner={{ ansible_user_id }} mode=0600
Zack Williamse4fbacc2016-05-21 07:18:43 -070074
Zack Williamsa3e40562016-07-05 12:05:39 -070075 - name: Download Glance VM images
Zack Williams363bc852016-04-12 13:58:29 -070076 get_url:
Zack Williams62587be2016-05-25 15:56:45 -070077 url={{ item.url }}
78 checksum={{ item.checksum }}
Scott Baker333a3152016-06-29 08:58:42 -070079 dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/images/{{ item.name }}.img
Zack Williams62587be2016-05-25 15:56:45 -070080 with_items: "{{ xos_images }}"
Zack Williams363bc852016-04-12 13:58:29 -070081
Zack Williamsa3e40562016-07-05 12:05:39 -070082 - name: Pull database and cord-app-build image
83 become: yes
84 command: docker pull {{ item }}
85 with_items:
86 - xosproject/xos-postgres
87 - xosproject/cord-app-build
Zack Williams35624562016-08-28 17:12:26 -070088 tags:
89 - skip_ansible_lint # FIXME: use new 2.2 docker modules when available
Zack Williamsa3e40562016-07-05 12:05:39 -070090
Zack Williamsd31bbc92016-05-20 11:43:18 -070091 - name: Pull docker images for XOS
Zack Williams72a9ab42016-06-08 08:32:49 -070092 when: not xos_container_rebuild
Zack Williams09df9d62016-05-27 22:39:38 -070093 become: yes
94 command: docker pull {{ item }}
95 with_items:
96 - xosproject/xos-base
Zack Williams363bc852016-04-12 13:58:29 -070097
Zack Williams72a9ab42016-06-08 08:32:49 -070098 - name: Rebuild XOS containers
99 when: xos_container_rebuild
100 command: make {{ item }}
Zack Williamsa3e40562016-07-05 12:05:39 -0700101 chdir="{{ xos_repo_dest }}/containers/xos/"
Zack Williams72a9ab42016-06-08 08:32:49 -0700102 with_items:
103 - base
Zack Williams35624562016-08-28 17:12:26 -0700104
105