move docker installation into it's own playbook, run when creating vm's
diff --git a/roles/create-vms/files/docker-install-playbook.yml b/roles/create-vms/files/docker-install-playbook.yml
new file mode 100644
index 0000000..601d8b2
--- /dev/null
+++ b/roles/create-vms/files/docker-install-playbook.yml
@@ -0,0 +1,40 @@
+---
+# Installs docker with apt, docker-compose with pip, adds user to group
+# Must be run as root
+
+# https://docs.docker.com/engine/installation/linux/ubuntulinux/
+- name: Prereqs and SSL support for apt for SSL
+ apt:
+ name={{ item }}
+ update_cache=yes
+ cache_valid_time=3600
+ with_items:
+ - apt-transport-https
+ - ca-certificates
+ - python-pip
+
+- name: Trust docker apt key
+ apt_key:
+ keyserver=pool.sks-keyservers.net
+ id=58118E89F3A912897C070ADBF76221572C52609D
+
+- name: Add docker apt repo
+ apt_repository:
+ repo="deb https://apt.dockerproject.org/repo ubuntu-trusty main"
+
+- name: Install docker
+ apt:
+ update_cache=yes
+ cache_valid_time=3600
+ name=docker-engine
+
+- name: Make user part of the Docker group
+ user:
+ name={{ ansible_user_id }}
+ groups="docker" append=yes
+
+# https://docs.docker.com/compose/install/#install-using-pip
+- name: Install docker-compose from PyPi
+ pip:
+ name=docker-compose
+
diff --git a/roles/create-vms/tasks/main.yml b/roles/create-vms/tasks/main.yml
index f830fde..c6e766b 100644
--- a/roles/create-vms/tasks/main.yml
+++ b/roles/create-vms/tasks/main.yml
@@ -50,7 +50,16 @@
command: ansible services -m ping -u ubuntu
# sshkey is registered in head-prep task
-- name: Enable root ssh login on VM's that need it
+- name: Enable root ssh login on VM's that require it
command: ansible {{ item.name }} -b -u ubuntu -m authorized_key -a "user='root' key='{{ sshkey.stdout }}'"
with_items: "{{ head_vm_list | selectattr('root_ssh_login', 'defined') | list }}"
+- name: Copy over docker installation playbook
+ copy:
+ src="docker-install-playbook.yml"
+ dest="{{ ansible_user_dir }}/docker-install-playbook.yml"
+
+- name: Install docker in VM's that require it
+ command: ansible-playbook -i {{ item.name }} -b -u ubuntu "{{ ansible_user_dir }}/docker-install-playbook.yml"
+ with_items: "{{ head_vm_list | selectattr('docker_path', 'defined') | list }}"
+
diff --git a/roles/onos-vm-install/files/onos-setup-playbook.yml b/roles/onos-vm-install/files/onos-setup-playbook.yml
index 94352be..419d52b 100644
--- a/roles/onos-vm-install/files/onos-setup-playbook.yml
+++ b/roles/onos-vm-install/files/onos-setup-playbook.yml
@@ -6,48 +6,6 @@
- name: Include configuration vars
include_vars: onos-setup-vars.yml
- # https://docs.docker.com/engine/installation/linux/ubuntulinux/
- - name: Prereqs and SSL support for apt for SSL
- become: yes
- apt:
- name={{ item }}
- update_cache=yes
- cache_valid_time=3600
- with_items:
- - apt-transport-https
- - ca-certificates
- - python-pip
-
- - name: Trust docker apt key
- become: yes
- apt_key:
- keyserver=pool.sks-keyservers.net
- id=58118E89F3A912897C070ADBF76221572C52609D
-
- - name: Add docker apt repo
- become: yes
- apt_repository:
- repo="deb https://apt.dockerproject.org/repo ubuntu-trusty main"
-
- - name: Install docker
- become: yes
- apt:
- update_cache=yes
- cache_valid_time=3600
- name=docker-engine
-
- - name: Make user part of the Docker group
- become: yes
- user:
- name={{ ansible_user_id }}
- groups="docker" append=yes
-
- # https://docs.docker.com/compose/install/#install-using-pip
- - name: Install docker-compose from PyPi
- become: yes
- pip:
- name=docker-compose
-
- name: Create CORD directory
file:
path={{ ansible_user_dir }}/cord
@@ -70,15 +28,11 @@
- Dockerfile.xos-onos
- onos-service
- - name: Copy over docker-compose.yml files
+ - name: Copy over & rename docker-compose file
copy:
src=~/onos-docker-compose.yml
dest={{ ansible_user_dir }}/cord/docker-compose.yml
- # The become here is to work around user not being in the docker group
- # until the next login, so become it again to reload group membership
- name: Pull docker image for ONOS
- become: yes
- become_user: "{{ ansible_user_id }}"
command: docker pull onosproject/onos
diff --git a/roles/xos-vm-install/files/xos-setup-cord-pod-playbook.yml b/roles/xos-vm-install/files/xos-setup-cord-pod-playbook.yml
index 490a892..d4116ec 100644
--- a/roles/xos-vm-install/files/xos-setup-cord-pod-playbook.yml
+++ b/roles/xos-vm-install/files/xos-setup-cord-pod-playbook.yml
@@ -15,6 +15,7 @@
with_items:
- git
- make
+ - curl
- python-novaclient
- python-neutronclient
- python-keystoneclient
@@ -27,9 +28,6 @@
version={{ xos_repo_branch }}
force=yes
- - name: Make XOS prerequisites
- command: make -f {{ xos_repo_dest }}/xos/configurations/common/Makefile.prereqs
-
- name: Copy over SSH keys
copy:
src=~/.ssh/{{ item }}
@@ -39,21 +37,17 @@
- id_rsa
- id_rsa.pub
+ - name: copy over SSH key as node_key
+ copy:
+ src=~/.ssh/id_rsa
+ dest={{ xos_repo_dest }}/xos/configurations/{{ xos_configuration }}/node_key
+
- name: download software image
get_url:
url=http://www.vicci.org/opencloud/trusty-server-cloudimg-amd64-disk1.img
checksum=sha256:5fb160ea09649f9cebe5cfd7aaf3d1a341e8e0f9eca6e52e46eb6271155c48b0
dest={{ xos_repo_dest }}/xos/configurations/{{ xos_configuration }}/images/trusty-server-multi-nic.img
- - name: copy over SSH key as node_key
- copy:
- src=~/.ssh/id_rsa
- dest={{ xos_repo_dest }}/xos/configurations/{{ xos_configuration }}/node_key
-
- # The become here is to work around user not being in the docker group
- # until the next login, so become it again to reload group membership
- name: Pull docker images for XOS
- become: yes
- become_user: "{{ ansible_user_id }}"
command: docker-compose pull chdir="{{ xos_repo_dest }}/xos/configurations/{{ xos_configuration }}"
diff --git a/vars/cord_defaults.yml b/vars/cord_defaults.yml
index 72dd991..db8744a 100644
--- a/vars/cord_defaults.yml
+++ b/vars/cord_defaults.yml
@@ -15,17 +15,6 @@
- apt.dockerproject.org
- butler.opencloud.cs.arizona.edu
-docker_compose_list:
- - name: 'onos-cord-1'
- path: 'cord'
- build: yes
- up: yes
-
- - name: 'xos-1'
- path: 'xos/xos/configurations/cord-pod'
- build: no
- up: no
-
charm_versions:
ceilometer: "cs:trusty/ceilometer-17"
ceilometer-agent: "cs:trusty/ceilometer-agent-13"
@@ -156,6 +145,7 @@
cpu: 2
memMB: 4096
diskGB: 40
+ docker_path: "cord"
- name: "onos-fabric-1"
aliases:
@@ -172,6 +162,7 @@
cpu: 2
memMB: 4096
diskGB: 40
+ docker_path: 'xos/xos/configurations/cord-pod'
- name: "nova-compute-1"
service: "nova-compute"