install directly on head node
Change-Id: I861fda9725acbc222337f232ca0ffb2c1742e44c
diff --git a/cord-head-playbook.yml b/cord-head-playbook.yml
index 8a821cf..5f1a401 100644
--- a/cord-head-playbook.yml
+++ b/cord-head-playbook.yml
@@ -50,11 +50,11 @@
- name: Set up VM's, juju, start ONOS and XOS
hosts: head
roles:
- - xos-vm-install
+ - xos-install
- onos-vm-install
- juju-setup
- docker-compose
- - xos-start
+ - xos-head-start
- name: Set up Automated Compute Node Provisioning
hosts: head
diff --git a/roles/docker-compose/tasks/main.yml b/roles/docker-compose/tasks/main.yml
index a623cf1..8162d0a 100644
--- a/roles/docker-compose/tasks/main.yml
+++ b/roles/docker-compose/tasks/main.yml
@@ -31,18 +31,26 @@
command: ansible onos-cord-1:onos-fabric-1 -u ubuntu -m command \
-a "docker-compose up -d chdir=cord"
-- name: Wait for xos_setup_playbook to complete
- when: "{{ head_vm_list | map(attribute='name') | list | intersect(['xos-1']) | list | length }}"
- async_status: jid={{ xos_setup_playbook.ansible_job_id }}
- register: xos_setup_playbook_result
- until: xos_setup_playbook_result.finished
- delay: 10
- retries: 120
+#- name: Wait for xos_setup_playbook to complete
+# when: "{{ head_vm_list | map(attribute='name') | list | intersect(['xos-1']) | list | length }}"
+# async_status: jid={{ xos_setup_playbook.ansible_job_id }}
+# register: xos_setup_playbook_result
+# until: xos_setup_playbook_result.finished
+# delay: 10
+# retries: 120
-- name: Copy admin-openrc.sh into XOS container
- when: "{{ head_vm_list | map(attribute='name') | list | intersect(['xos-1']) | list | length }}"
- command: ansible xos-1 -u ubuntu -m copy \
- -a "src=~/admin-openrc.sh dest={{ service_profile_repo_dest }}/{{ xos_configuration }}"
+#- name: Copy admin-openrc.sh into XOS container
+# when: "{{ head_vm_list | map(attribute='name') | list | intersect(['xos-1']) | list | length }}"
+# command: ansible xos-1 -u ubuntu -m copy \
+# -a "src=~/admin-openrc.sh dest={{ service_profile_repo_dest }}/{{ xos_configuration }}"
+
+- name: Copy admin-openrc.sh to service-profile
+ command: cp ~/admin-openrc.sh {{ service_profile_repo_dest }}/{{ xos_configuration }}
+ tags:
+ - skip_ansible_lint
+# copy:
+# src=~/admin-openrc.sh
+# dest={{ service_profile_repo_dest }}/{{ xos_configuration }}
- name: Wait for test client to complete installation
when: test_client_install is defined and test_client_install
diff --git a/roles/test-exampleservice/tasks/main.yml b/roles/test-exampleservice/tasks/main.yml
index 5d6a6bc..4df5ea8 100644
--- a/roles/test-exampleservice/tasks/main.yml
+++ b/roles/test-exampleservice/tasks/main.yml
@@ -4,19 +4,17 @@
# Run tests to check that the single-node deployment has worked
- name: Onboard ExampleService and instantiate a VM
- command: ansible xos-1 -u ubuntu -m shell \
- -a "cd ~/service-profile/cord-pod; make exampleservice"
+ command: chdir="{{ service_profile_repo_dest }}/{{ xos_configuration }}" bash -c "make exampleservice |& tee xos-make-exampleservice.out"
tags:
- - skip_ansible_lint # running a sub job
+ - skip_ansible_lint
- name: Pause 60 seconds (work around bug in synchronizer)
pause: seconds=60
- name: Re-run 'make vtn' (work around bug in synchronizer)
- command: ansible xos-1 -u ubuntu -m shell \
- -a "cd ~/service-profile/cord-pod; make vtn"
+ command: chdir="{{ service_profile_repo_dest }}/{{ xos_configuration }}" bash -c "make vtn |& tee xos-makevtn3.out"
tags:
- - skip_ansible_lint # running a sub job
+ - skip_ansible_lint
- name: Wait for ExampleService VM to come up
shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep 'exampleservice.*ACTIVE' > /dev/null"
diff --git a/roles/test-vsg/tasks/main.yml b/roles/test-vsg/tasks/main.yml
index 7e02e15..8fc494f 100644
--- a/roles/test-vsg/tasks/main.yml
+++ b/roles/test-vsg/tasks/main.yml
@@ -3,20 +3,18 @@
#
# Run tests to check that the CORD-in-a-Box deployment has worked.
-- name: Create a sample CORD subscriber
- command: ansible xos-1 -u ubuntu -m shell \
- -a "cd ~/service-profile/cord-pod; make cord-subscriber"
+- name: Create cord subscriber
+ command: chdir="{{ service_profile_repo_dest }}/{{ xos_configuration }}" bash -c "make cord-subscriber |& tee xos-make-cord-subscriber.out"
tags:
- - skip_ansible_lint # running a sub job
+ - skip_ansible_lint
- name: Pause 60 seconds (work around bug in synchronizer)
pause: seconds=60
- name: Re-run 'make vtn' (work around bug in synchronizer)
- command: ansible xos-1 -u ubuntu -m shell \
- -a "cd ~/service-profile/cord-pod; make vtn"
+ command: chdir="{{ service_profile_repo_dest }}/{{ xos_configuration }}" bash -c "make vtn |& tee xos-makevtn2.out"
tags:
- - skip_ansible_lint # running a sub job
+ - skip_ansible_lint
- name: Wait for vSG VM to come up
shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep 'vsg.*ACTIVE' > /dev/null"
diff --git a/roles/xos-compute-setup/tasks/main.yml b/roles/xos-compute-setup/tasks/main.yml
index 1df8204..d159ff1 100644
--- a/roles/xos-compute-setup/tasks/main.yml
+++ b/roles/xos-compute-setup/tasks/main.yml
@@ -3,15 +3,15 @@
#
# Tell XOS that a new compute node has been added
-- name: ssh to XOS VM and run 'make new-nodes'
- command: ssh ubuntu@xos "cd {{ service_profile_repo_dest }}/{{ xos_configuration }}/; make new-nodes"
+- name: Build XOS containers
+ command: chdir="{{ service_profile_repo_dest }}/{{ xos_configuration }}" bash -c "make new-nodes |& tee xos-new-nodes.out"
tags:
- - skip_ansible_lint # running a sub-job
+ - skip_ansible_lint
- name: Pause 5 seconds
pause: seconds=5
-- name: ssh to XOS VM and run 'make vtn'
- command: ssh ubuntu@xos "cd {{ service_profile_repo_dest }}/{{ xos_configuration }}/; rm -f vtn-external.yaml; make vtn"
+- name: Rebuild VTN configuration with new nodes block
+ command: chdir="{{ service_profile_repo_dest }}/{{ xos_configuration }}" bash -c "rm -f vtn-external.yaml; make vtn |& tee xos-makevtn2.out"
tags:
- - skip_ansible_lint # running a sub-job
+ - skip_ansible_lint
diff --git a/roles/xos-head-start/tasks/main.yml b/roles/xos-head-start/tasks/main.yml
new file mode 100644
index 0000000..7f6807e
--- /dev/null
+++ b/roles/xos-head-start/tasks/main.yml
@@ -0,0 +1,36 @@
+---
+# xos-start/tasks/main.yml
+
+- name: Build XOS containers
+ command: chdir="{{ service_profile_repo_dest }}/{{ xos_configuration }}" bash -c "make local_containers |& tee xos-build.out"
+ tags:
+ - skip_ansible_lint
+
+- name: Onboard services and start XOS
+ command: chdir="{{ service_profile_repo_dest }}/{{ xos_configuration }}" bash -c "make xos |& tee xos-onboard.out"
+ tags:
+ - skip_ansible_lint
+
+- name: Pause to let XOS initialize
+ pause: seconds=120
+
+- name: Initial VTN configuration
+ command: chdir="{{ service_profile_repo_dest }}/{{ xos_configuration }}" bash -c "make vtn |& tee xos-makevtn.out"
+ tags:
+ - skip_ansible_lint
+
+- name: Initial fabric configuration
+ command: chdir="{{ service_profile_repo_dest }}/{{ xos_configuration }}" bash -c "make fabric |& tee xos-makefabric.out"
+ tags:
+ - skip_ansible_lint
+
+- name: Pause to let ONOS initialize
+ pause: seconds=20
+ tags:
+ - skip_ansible_lint
+
+- name: Configure CORD services
+ command: chdir="{{ service_profile_repo_dest }}/{{ xos_configuration }}" bash -c "make cord |& tee xos-makecord.out"
+ tags:
+ - skip_ansible_lint
+
diff --git a/roles/xos-install/defaults/main.yml b/roles/xos-install/defaults/main.yml
index c77f9ac..a18a274 100644
--- a/roles/xos-install/defaults/main.yml
+++ b/roles/xos-install/defaults/main.yml
@@ -4,9 +4,15 @@
xos_repo_url: "https://gerrit.opencord.org/xos"
xos_repo_dest: "~/xos"
xos_repo_branch: "HEAD"
+
xos_configuration: "devel"
-xos_container_rebuild: false
+
+xos_container_rebuild: False
service_profile_repo_url: "https://gerrit.opencord.org/p/service-profile.git"
service_profile_repo_dest: "~/service-profile"
service_profile_repo_branch: "HEAD"
+
+docker_tag: "latest"
+docker_registry: "docker.io"
+local_docker_registry: "docker-registry:5000"
diff --git a/roles/xos-install/tasks/main.yml b/roles/xos-install/tasks/main.yml
index 7008edb..5d5ac49 100644
--- a/roles/xos-install/tasks/main.yml
+++ b/roles/xos-install/tasks/main.yml
@@ -1,29 +1,143 @@
---
# tasks for xos-install role
-- name: checkout XOS repo
- git:
- repo: "{{ xos_repo_url }}"
- dest: "{{ xos_repo_dest }}"
- version: "{{ xos_repo_branch }}"
+- 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
-- name: checkout service-profile repo
+# ---- copy repos from the dev machine to the head node ----
+
+- name: Check to see if orchestration directory exists
+ local_action: stat path="{{ playbook_dir }}/../../orchestration"
+ register: orchestration
+
+- name: Copy repositories to the head node
+ synchronize:
+ src: "{{ playbook_dir }}/../../orchestration/{{ item }}"
+ dest: "{{ ansible_user_dir }}/"
+ when:
+ False # orchestration.stat.exists == True # XXX
+ with_items:
+ - service-profile
+ - xos
+ - xos_libraries
+ - xos_services
+
+- name: Check to see if onos_apps directory exists
+ local_action: stat path="{{ playbook_dir }}/../../onos-apps/apps"
+ register: onos_apps
+
+- name: Copy in onos-apps that have XOS code
+ synchronize:
+ src: "{{ playbook_dir }}/../../onos-apps/apps/{{ item }}"
+ dest: "{{ ansible_user_dir }}/xos_services/"
+ with_items:
+ - vtn
+ - olt
+ when:
+ False # (orchestration.stat.exists == True) and (onos_apps.stat.exists == True) # XXX
+
+# ---- 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 }}"
+ repo={{ service_profile_repo_url }}
+ dest={{ service_profile_repo_dest }}
+ version={{ service_profile_repo_branch }}
+ force=yes
+ when:
+ True # orchestration.stat.exists == False # XXX
+
+# ---- 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: Download Glance VM images
+ get_url:
+ url={{ item.url }}
+ checksum={{ item.checksum }}
+ dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/images/{{ item.name }}.img
+ 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
+ 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
+ when: docker_registry_check|succeeded
+
+# ---- optional: rebuild base container ----
- name: Rebuild XOS containers
when: xos_container_rebuild
- make:
- target: "{{ item }}"
- chdir: "{{ service_profile_repo_dest }}/{{ xos_configuration }}/"
+ command: make {{ item }}
+ chdir="{{ xos_repo_dest }}/containers/xos/"
with_items:
- - common_cloudlab
- - base
+ - base
-- name: Initial build of XOS
- make:
- target: "{{ item }}"
- chdir: "{{ service_profile_repo_dest }}/{{ xos_configuration }}/"
+
+
diff --git a/vars/cord_defaults.yml b/vars/cord_defaults.yml
index 3536446..353a9b2 100644
--- a/vars/cord_defaults.yml
+++ b/vars/cord_defaults.yml
@@ -170,14 +170,14 @@
diskGB: 40
docker_path: "cord"
- - name: "xos-1"
- aliases:
- - "xos"
- ipv4_last_octet: 130
- cpu: 2
- memMB: 4096
- diskGB: 40
- docker_path: 'service-profile/cord-pod'
+# - name: "xos-1"
+# aliases:
+# - "xos"
+# ipv4_last_octet: 130
+# cpu: 2
+# memMB: 4096
+# diskGB: 40
+# docker_path: 'service-profile/cord-pod'
vm_service_list:
diff --git a/vars/cord_single_defaults.yml b/vars/cord_single_defaults.yml
index 117073d..f062ac3 100644
--- a/vars/cord_single_defaults.yml
+++ b/vars/cord_single_defaults.yml
@@ -156,14 +156,14 @@
diskGB: 40
docker_path: "cord"
- - name: "xos-1"
- aliases:
- - "xos"
- ipv4_last_octet: 130
- cpu: 2
- memMB: 4096
- diskGB: 40
- docker_path: 'service-profile/cord-pod'
+# - name: "xos-1"
+# aliases:
+# - "xos"
+# ipv4_last_octet: 130
+# cpu: 2
+# memMB: 4096
+# diskGB: 40
+# docker_path: 'service-profile/cord-pod'
- name: "nova-compute-1"
service: "nova-compute"