blob: 72c4aa0f1f959829d057db93430bb8e0b6e008a9 [file] [log] [blame]
Zack Williamsfc102dd2016-03-01 17:31:30 -07001---
2# tasks for xos-install role
3
Scott Bakerdb5c8c72016-11-08 08:40:06 -08004- 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 Williamsd2cbe512016-06-03 09:33:15 -070018
Scott Baker34c02ac2017-01-16 08:58:52 -080019# ---- copy repos from the dev machine to the head node ----
Zack Williams43d62b52017-01-23 07:34:45 -070020# note: this happens in the `cord` repo now
Scott Baker34c02ac2017-01-16 08:58:52 -080021
Zack Williams43d62b52017-01-23 07:34:45 -070022# - name: Create cord destination directory
23# become: yes
24# file:
25# path: "{{ cord_dest_dir }}"
26# state: directory
27# mode: 0755
28# owner: "{{ ansible_user_id }}"
Scott Baker34c02ac2017-01-16 08:58:52 -080029
Zack Williams43d62b52017-01-23 07:34:45 -070030# - name: Copy the whole repo tree
31# synchronize:
32# src: "{{ playbook_dir }}/../../../cord/"
33# dest: "{{ cord_dest_dir }}/"
Scott Baker34c02ac2017-01-16 08:58:52 -080034
35- name: Create directory xos_services
36 file:
37 path: "{{ ansible_user_dir }}/xos_services"
38 state: directory
39 mode: 0755
40
41- name: Create directory xos_libraries
42 file:
43 path: "{{ ansible_user_dir }}/xos_libraries"
44 state: directory
45 mode: 0755
46
47- name: Create bindings to service-profile and xos
48 become: yes
49 mount:
50 src: "{{ cord_dest_dir }}/orchestration/{{ item }}"
51 name: "{{ ansible_user_dir }}/{{ item }}"
52 fstype: none
53 opts: rw,bind
54 state: mounted
Scott Bakerdb5c8c72016-11-08 08:40:06 -080055 with_items:
56 - service-profile
57 - xos
Scott Bakerdb5c8c72016-11-08 08:40:06 -080058
Scott Baker34c02ac2017-01-16 08:58:52 -080059- name: Create bindings for xos services
60 become: yes
61 mount:
62 src: "{{ cord_dest_dir }}/orchestration/xos_services/{{ item }}"
63 name: "{{ ansible_user_dir }}/xos_services/{{ item }}"
64 fstype: none
65 opts: rw,bind
66 state: mounted
67 with_items:
68 - exampleservice
69 - fabric
70 - globalxos
71 - hypercache
72 - metro-net
73 - monitoring
74 - onos-service
75 - openstack
76 - vrouter
77 - vsg
78 - vtr
Scott Bakerdb5c8c72016-11-08 08:40:06 -080079
Scott Baker34c02ac2017-01-16 08:58:52 -080080- name: Create bindings for xos services that reside in onos
81 become: yes
82 mount:
83 src: "{{ cord_dest_dir }}/onos-apps/apps/{{ item }}"
84 name: "{{ ansible_user_dir }}/xos_services/{{ item }}"
85 fstype: none
86 opts: rw,bind
87 state: mounted
Scott Bakerdb5c8c72016-11-08 08:40:06 -080088 with_items:
89 - vtn
90 - olt
Scott Bakerdb5c8c72016-11-08 08:40:06 -080091
Scott Baker34c02ac2017-01-16 08:58:52 -080092- name: Create bindings for xos libraries
93 become: yes
94 mount:
95 src: "{{ cord_dest_dir }}/orchestration/xos_libraries/{{ item }}"
96 name: "{{ ansible_user_dir }}/xos_libraries/{{ item }}"
97 fstype: none
98 opts: rw,bind
99 state: mounted
100 with_items:
101 - ng-xos-lib
102
103# ---- alternatively, check out repos from Internet ---
104
105- name: Clone service-profile repo
106 git:
107 repo={{ service_profile_repo_url }}
108 dest={{ service_profile_repo_dest }}
109 version={{ service_profile_repo_branch }}
110 force=yes
111 when:
112 False
113
114# ---- install keys ----
115
Scott Bakerdb5c8c72016-11-08 08:40:06 -0800116- name: Copy over SSH keys
117 command: cp ~/.ssh/{{ item }} {{ service_profile_repo_dest }}/{{ xos_configuration }}/
118 with_items:
119 - id_rsa
120 - id_rsa.pub
121 tags:
122 - skip_ansible_lint
123
124- name: Copy over node key
125 command: cp {{ ansible_user_dir }}/node_key {{ service_profile_repo_dest }}/{{ xos_configuration }}/
126 tags:
127 - skip_ansible_lint
128
129- name: Set ownership and permissions of keys
130 file:
131 path={{ service_profile_repo_dest }}/{{ xos_configuration }}/{{ item }}
132 owner={{ ansible_user_id }}
133# mode=0600
134 with_items:
135 - id_rsa
136 - id_rsa.pub
137 - node_key
138
Zack Williams682450e2016-11-19 09:04:41 -0700139- name: Create templated TOSCA files
140 template:
141 src: "{{ item }}.j2"
142 dest: "{{ service_profile_repo_dest }}/{{ xos_configuration }}/{{ item }}"
143 with_items: "{{ xos_tosca_templates }}"
Scott Bakerdb5c8c72016-11-08 08:40:06 -0800144
145- name: Download Glance VM images
146 get_url:
147 url={{ item.url }}
148 checksum={{ item.checksum }}
Zack Williams682450e2016-11-19 09:04:41 -0700149 dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/images/{{ item.name }}.qcow2
Scott Bakerdb5c8c72016-11-08 08:40:06 -0800150 with_items: "{{ xos_images }}"
151
152# ---- pull docker images ----
153
154- name: Check to see if registry is reachable
155 command: curl -sf http://docker-registry:5000/
156 ignore_errors: yes
157 register: docker_registry_check
158 tags:
159 - skip_ansible_lint
160
161- name: Use registry if it is available
162 set_fact:
163 docker_registry: "{{ local_docker_registry }}"
164 docker_opts: "--insecure-registry {{ local_docker_registry }}"
165 docker_tag: "candidate"
166 when: docker_registry_check|succeeded
167
168- name: Pull docker images for XOS
169 become: yes
170 command: docker pull {{ docker_registry }}/{{ item }}:{{ docker_tag }}
171 with_items:
172 - xosproject/xos-base
173 - xosproject/xos-postgres
174 - xosproject/cord-app-build
175 - redis
Scott Bakerc00f9c02017-01-19 09:40:14 -0800176 - nginx
177 - node
Scott Bakerdb5c8c72016-11-08 08:40:06 -0800178 tags:
179 - skip_ansible_lint
180
181- name: Tag the images downloaded from the local registry
182 command: docker tag {{ docker_registry }}/{{ item }}:{{ docker_tag }} {{ item }}:latest
183 with_items:
184 - xosproject/xos-base
185 - xosproject/xos-postgres
186 - xosproject/cord-app-build
187 - redis
Scott Bakerc00f9c02017-01-19 09:40:14 -0800188 - nginx
189 when: docker_registry_check|succeeded
190
191- name: Separately tag the node image with tag argon
192 command: docker tag {{ docker_registry }}/node:{{ docker_tag }} node:argon
Scott Bakerdb5c8c72016-11-08 08:40:06 -0800193 when: docker_registry_check|succeeded
194
Zack Williamsc563b572016-06-03 09:49:53 -0700195
Scott Bakerdb5c8c72016-11-08 08:40:06 -0800196
197
Zack Williamsd2cbe512016-06-03 09:33:15 -0700198