blob: 58d2e507279e57997de6bb0d616a50b612e17e0d [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 Bakerdb5c8c72016-11-08 08:40:06 -080019- name: Copy repositories to the head node
20 synchronize:
21 src: "{{ playbook_dir }}/../../orchestration/{{ item }}"
22 dest: "{{ ansible_user_dir }}/"
Scott Bakerdb5c8c72016-11-08 08:40:06 -080023 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 Bakerdb5c8c72016-11-08 08:40:06 -080040
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 Williams682450e2016-11-19 09:04:41 -070064- 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 Bakerdb5c8c72016-11-08 08:40:06 -080069
70- name: Download Glance VM images
71 get_url:
72 url={{ item.url }}
73 checksum={{ item.checksum }}
Zack Williams682450e2016-11-19 09:04:41 -070074 dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/images/{{ item.name }}.qcow2
Scott Bakerdb5c8c72016-11-08 08:40:06 -080075 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 Williamsc563b572016-06-03 09:49:53 -0700113
Scott Bakerdb5c8c72016-11-08 08:40:06 -0800114
115
Zack Williamsd2cbe512016-06-03 09:33:15 -0700116