blob: 846d1a571b05a0955d350677d608fdcf514672c2 [file] [log] [blame]
---
# tasks for xos-install role
- name: Install prerequisites
apt:
name={{ item }}
update_cache=yes
cache_valid_time=3600
become: yes
with_items:
- git
- make
- curl
- python-novaclient
- python-neutronclient
- python-keystoneclient
- python-glanceclient
# ---- copy repos from the dev machine to the head node ----
# note: this happens in the `cord` repo now
# - name: Create cord destination directory
# become: yes
# file:
# path: "{{ cord_dest_dir }}"
# state: directory
# mode: 0755
# owner: "{{ ansible_user_id }}"
# - name: Copy the whole repo tree
# synchronize:
# src: "{{ playbook_dir }}/../../../cord/"
# dest: "{{ cord_dest_dir }}/"
- name: Create directory xos_services
file:
path: "{{ ansible_user_dir }}/xos_services"
state: directory
mode: 0755
- name: Create directory xos_libraries
file:
path: "{{ ansible_user_dir }}/xos_libraries"
state: directory
mode: 0755
- name: Create bindings to service-profile and xos
become: yes
mount:
src: "{{ cord_dest_dir }}/orchestration/{{ item }}"
name: "{{ ansible_user_dir }}/{{ item }}"
fstype: none
opts: rw,bind
state: mounted
with_items:
- service-profile
- xos
- name: Create bindings for xos services
become: yes
mount:
src: "{{ cord_dest_dir }}/orchestration/xos_services/{{ item }}"
name: "{{ ansible_user_dir }}/xos_services/{{ item }}"
fstype: none
opts: rw,bind
state: mounted
with_items:
- exampleservice
- fabric
- globalxos
- hypercache
- metro-net
- monitoring
- onos-service
- openstack
- vrouter
- vsg
- vtr
- name: Create bindings for xos services that reside in onos
become: yes
mount:
src: "{{ cord_dest_dir }}/onos-apps/apps/{{ item }}"
name: "{{ ansible_user_dir }}/xos_services/{{ item }}"
fstype: none
opts: rw,bind
state: mounted
with_items:
- vtn
- olt
- name: Create bindings for xos libraries
become: yes
mount:
src: "{{ cord_dest_dir }}/orchestration/xos_libraries/{{ item }}"
name: "{{ ansible_user_dir }}/xos_libraries/{{ item }}"
fstype: none
opts: rw,bind
state: mounted
with_items:
- ng-xos-lib
# ---- alternatively, check out repos from Internet ---
- name: Clone service-profile repo
git:
repo={{ service_profile_repo_url }}
dest={{ service_profile_repo_dest }}
version={{ service_profile_repo_branch }}
force=yes
when:
False
# ---- install keys ----
- name: Copy over SSH keys
command: cp ~/.ssh/{{ item }} {{ service_profile_repo_dest }}/{{ xos_configuration }}/
with_items:
- id_rsa
- id_rsa.pub
tags:
- skip_ansible_lint
- name: Copy over node key
command: cp {{ ansible_user_dir }}/node_key {{ service_profile_repo_dest }}/{{ xos_configuration }}/
tags:
- skip_ansible_lint
- name: Set ownership and permissions of keys
file:
path={{ service_profile_repo_dest }}/{{ xos_configuration }}/{{ item }}
owner={{ ansible_user_id }}
# mode=0600
with_items:
- id_rsa
- id_rsa.pub
- node_key
- name: Copy over core api key
copy:
src: "{{ playbook_dir }}/pki/intermediate_ca/private/xos-core.{{ site_suffix }}_key.pem"
dest: "{{ service_profile_repo_dest }}/{{ xos_configuration }}/core_api_key.pem"
mode: 0600
- name: Copy over core api cert
copy:
src: "{{ playbook_dir }}/pki/intermediate_ca/certs/xos-core.{{ site_suffix }}_cert_chain.pem"
dest: "{{ service_profile_repo_dest }}/{{ xos_configuration }}/core_api_cert.pem"
- name: Create templated TOSCA files
template:
src: "{{ item }}.j2"
dest: "{{ service_profile_repo_dest }}/{{ xos_configuration }}/{{ item }}"
with_items: "{{ xos_tosca_templates }}"
- name: Download Glance VM images
get_url:
url={{ item.url }}
checksum={{ item.checksum }}
dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/images/{{ item.name }}.qcow2
with_items: "{{ xos_images }}"
# ---- pull docker images ----
- name: Check to see if registry is reachable
command: curl -sf http://docker-registry:5000/
ignore_errors: yes
register: docker_registry_check
tags:
- skip_ansible_lint
- name: Use registry if it is available
set_fact:
docker_registry: "{{ local_docker_registry }}"
docker_opts: "--insecure-registry {{ local_docker_registry }}"
docker_tag: "candidate"
when: docker_registry_check|succeeded
- name: Pull docker images for XOS
become: yes
command: docker pull {{ docker_registry }}/{{ item }}:{{ docker_tag }}
with_items:
- xosproject/xos-base
- xosproject/xos-postgres
- xosproject/cord-app-build
- redis
- nginx
- node
tags:
- skip_ansible_lint
- name: Tag the images downloaded from the local registry
command: docker tag {{ docker_registry }}/{{ item }}:{{ docker_tag }} {{ item }}:latest
with_items:
- xosproject/xos-base
- xosproject/xos-postgres
- xosproject/cord-app-build
- redis
- nginx
when: docker_registry_check|succeeded
- name: Separately tag the node image with tag argon
command: docker tag {{ docker_registry }}/node:{{ docker_tag }} node:argon
when: docker_registry_check|succeeded