blob: 846d1a571b05a0955d350677d608fdcf514672c2 [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
Scott Baker06f13b82017-01-26 16:54:25 -0800139- name: Copy over core api key
140 copy:
141 src: "{{ playbook_dir }}/pki/intermediate_ca/private/xos-core.{{ site_suffix }}_key.pem"
142 dest: "{{ service_profile_repo_dest }}/{{ xos_configuration }}/core_api_key.pem"
143 mode: 0600
144
145- name: Copy over core api cert
146 copy:
147 src: "{{ playbook_dir }}/pki/intermediate_ca/certs/xos-core.{{ site_suffix }}_cert_chain.pem"
148 dest: "{{ service_profile_repo_dest }}/{{ xos_configuration }}/core_api_cert.pem"
149
Zack Williams682450e2016-11-19 09:04:41 -0700150- name: Create templated TOSCA files
151 template:
152 src: "{{ item }}.j2"
153 dest: "{{ service_profile_repo_dest }}/{{ xos_configuration }}/{{ item }}"
154 with_items: "{{ xos_tosca_templates }}"
Scott Bakerdb5c8c72016-11-08 08:40:06 -0800155
156- name: Download Glance VM images
157 get_url:
158 url={{ item.url }}
159 checksum={{ item.checksum }}
Zack Williams682450e2016-11-19 09:04:41 -0700160 dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/images/{{ item.name }}.qcow2
Scott Bakerdb5c8c72016-11-08 08:40:06 -0800161 with_items: "{{ xos_images }}"
162
163# ---- pull docker images ----
164
165- name: Check to see if registry is reachable
166 command: curl -sf http://docker-registry:5000/
167 ignore_errors: yes
168 register: docker_registry_check
169 tags:
170 - skip_ansible_lint
171
172- name: Use registry if it is available
173 set_fact:
174 docker_registry: "{{ local_docker_registry }}"
175 docker_opts: "--insecure-registry {{ local_docker_registry }}"
176 docker_tag: "candidate"
177 when: docker_registry_check|succeeded
178
179- name: Pull docker images for XOS
180 become: yes
181 command: docker pull {{ docker_registry }}/{{ item }}:{{ docker_tag }}
182 with_items:
183 - xosproject/xos-base
184 - xosproject/xos-postgres
185 - xosproject/cord-app-build
186 - redis
Scott Bakerc00f9c02017-01-19 09:40:14 -0800187 - nginx
188 - node
Scott Bakerdb5c8c72016-11-08 08:40:06 -0800189 tags:
190 - skip_ansible_lint
191
192- name: Tag the images downloaded from the local registry
193 command: docker tag {{ docker_registry }}/{{ item }}:{{ docker_tag }} {{ item }}:latest
194 with_items:
195 - xosproject/xos-base
196 - xosproject/xos-postgres
197 - xosproject/cord-app-build
198 - redis
Scott Bakerc00f9c02017-01-19 09:40:14 -0800199 - nginx
200 when: docker_registry_check|succeeded
201
202- name: Separately tag the node image with tag argon
203 command: docker tag {{ docker_registry }}/node:{{ docker_tag }} node:argon
Scott Bakerdb5c8c72016-11-08 08:40:06 -0800204 when: docker_registry_check|succeeded
205
Zack Williamsc563b572016-06-03 09:49:53 -0700206
Scott Bakerdb5c8c72016-11-08 08:40:06 -0800207
208
Zack Williamsd2cbe512016-06-03 09:33:15 -0700209