Merge remote-tracking branch 'origin/master' into roles
diff --git a/README.md b/README.md
index bf84b8b..9b86cba 100644
--- a/README.md
+++ b/README.md
@@ -42,12 +42,15 @@
$ ansible -i cord-hosts head -m ping
$ ansible -i cord-hosts compute -m ping
```
-* Run:
+* Run the following command:
```
ansible-playbook -i cord-hosts cord-setup.yml
```
+* Be patient! Some tasks in the above playbook can take a while to complete. For example,
+ the "Add virtual machines to Juju's control" task will take about 10 minutes (or more, if you have a
+ slow Internet connection).
* After the playbook finishes, wait for the OpenStack services to come up. You can check on their progress
- using `juju status --format=tabular`
+ using `juju status --format=tabular`. It should take about 30 minutes to install and configure all the OpenStack services.
* Once the services are up, you can use the `admin-openrc.sh` credentials in the home directory to
interact with OpenStack. You can SSH to any VM using `ssh ubuntu@<vm-name>`
@@ -73,24 +76,22 @@
The process for setting up a CORD test environment on CloudLab is similar (but
not identical) to the one for setting up a CORD POD above.
-* Start a CloudLab experiment using profile *OnePC-Ubuntu14.04.3*
+* Start a CloudLab experiment using profile *OnePC-Ubuntu14.04.4*
* Run the `bootstrap.sh` script to install Ansible and set up keys for login via `localhost`
* Run:
```
ansible-playbook -i cord-test-hosts cord-setup.yml
```
+As mentioned above, be patient! With a fast Internet connection, the entire process will take about
+one hour to complete.
-This will bring up various OpenStack services, including Neutron with the VTN plugin. It will also create
+The install will bring up various OpenStack services, including Neutron with the VTN plugin. It will also create
two VMs called *xos* and *onos-cord* and prep them. It creates a single nova-compute
node running inside a VM.
It should be possible to use this method on any server running Ubuntu 14.04, as long as it has
-sufficient CPU cores and disk space.
+sufficient CPU cores and disk space. A server with at least 12 cores and 48GB RAM is recommended.
-*NOTE:* Currently VMs can be created using this configuration and logged into over the
-VTN-supplied management network. However without the CORD fabric they don't have external
-connectivity, and as a result a vSG cannot be spun up. A workaround for this issue
-should be in place shortly.
## How to install an OpenCloud cluster
diff --git a/ansible.cfg b/ansible.cfg
index 4c51a24..d1c3f7f 100644
--- a/ansible.cfg
+++ b/ansible.cfg
@@ -1,2 +1,6 @@
[ssh_connection]
ssh_args=-o ControlMaster=no
+
+[defaults]
+callback_whitelist = profile_tasks
+deprecation_warnings = False
diff --git a/hawaii-compute.yml b/hawaii-compute.yml
new file mode 100644
index 0000000..c342483
--- /dev/null
+++ b/hawaii-compute.yml
@@ -0,0 +1,72 @@
+---
+- hosts: head
+ sudo: no
+ user: ubuntu
+ tasks:
+ - name: Remind user what is going to happen
+ pause: prompt="Install nova-compute on all unused machines managed by Juju"
+
+ - name: Deploy nova-compute
+ script: scripts/juju-compute-setup.py
+
+ - name: Try to avoid race condition
+ pause: seconds=5
+
+ - name: Wait until nova-compute is deployed
+ script: scripts/wait-for-services.sh
+
+ - name: Make sure we're using KVM
+ shell: juju set nova-compute virt-type=kvm
+
+ - name: Add nova-compute relations
+ script: scripts/juju-compute-relations.py
+
+ - name: Try to avoid race condition
+ pause: seconds=5
+
+ - name: Wait until relations are added
+ script: scripts/wait-for-services.sh
+
+# Play: set up ansible-pull for OpenCloud-specific files on nova-compute nodes
+- hosts: compute
+ sudo: yes
+ user: ubuntu
+ vars:
+
+ # schedule is fed directly to cron
+ schedule: '*/15 * * * *'
+
+ # User to run ansible-pull as from cron
+ cron_user: root
+
+ # File that ansible will use for logs
+ logfile: /var/log/ansible-pull.log
+
+ # Directory to where repository will be cloned
+ workdir: /var/lib/ansible/local
+
+ # Repository to check out
+ # repo must contain a local.yml file at top level
+ #repo_url: git://github.com/sfromm/ansible-playbooks.git
+ repo_url: git://github.com/andybavier/opencloud-nova-compute-ansible.git
+
+ # Branch or tag to checkout
+ repo_version: kilo
+
+ tasks:
+
+ - name: Install ansible
+ apt: name=ansible state=installed
+
+ - name: Basic ansible inventory
+ template: src=templates/etc/ansible/hosts.j2
+ dest=/etc/ansible/hosts
+
+ - name: Create local directory to work from
+ file: path={{workdir}} state=directory owner=root group=root mode=0751
+
+ - name: Create crontab entry to clone/pull git repository
+ template: src=templates/etc/cron.d/ansible-pull.j2 dest=/etc/cron.d/ansible-pull owner=root group=root mode=0644
+
+ - name: Create logrotate entry for ansible-pull.log
+ template: src=templates/etc/logrotate.d/ansible-pull.j2 dest=/etc/logrotate.d/ansible-pull owner=root group=root mode=0644
diff --git a/hawaii-hosts b/hawaii-hosts
new file mode 100644
index 0000000..3fa68e3
--- /dev/null
+++ b/hawaii-hosts
@@ -0,0 +1,11 @@
+head ansible_ssh_host=node13-syn.its.hawaii.edu
+
+[compute]
+node14-syn.its.hawaii.edu
+node15-syn.its.hawaii.edu
+node16-syn.its.hawaii.edu
+node17-syn.its.hawaii.edu
+node18-syn.its.hawaii.edu
+
+[all:vars]
+cloudlab=false
diff --git a/hawaii-setup.yml b/hawaii-setup.yml
new file mode 100644
index 0000000..9dde236
--- /dev/null
+++ b/hawaii-setup.yml
@@ -0,0 +1,280 @@
+---
+# Play: set up head node
+# Assumes basic /etc/ansible/hosts file
+- hosts: head
+ user: ubuntu
+ sudo: yes
+ vars:
+ # Each OpenCloud cluster needs a unique mgmt_net_prefix
+ mgmt_net_prefix: 192.168.104
+ tasks:
+
+ - apt: name={{ item }} update_cache=yes
+ with_items:
+ - python-pycurl
+ - software-properties-common
+
+ - name: Add Juju repository
+ apt_repository: repo="ppa:juju/stable"
+
+ - name: Add Ansible repository
+ apt_repository: repo="ppa:ansible/ansible"
+
+ - name: Update Ansible cache
+ apt: update_cache=yes
+
+ - name: Install packages
+ apt: name={{ item }} state=latest
+ with_items:
+ - ansible
+ - uvtool
+ - git
+ - bzr
+ - juju-core
+ - python-novaclient
+ - python-neutronclient
+ - python-keystoneclient
+ - python-glanceclient
+
+ - name: Get juju-ansible git repo
+ git: repo=https://github.com/cmars/juju-ansible.git
+ dest=/usr/local/src/juju-ansible
+
+ - name: Set up juju-ansible symlink
+ file: dest=/usr/local/bin/juju-ansible
+ src=/usr/local/src/juju-ansible/juju-ansible
+ state=link
+
+ - name: Set up juju-ansible-playbook symlink
+ file: dest=/usr/local/bin/juju-ansible-playbook
+ src=/usr/local/src/juju-ansible/juju-ansible
+ state=link
+
+ - name: Generate key to use in VMs
+ user: name={{ ansible_env['SUDO_USER'] }} generate_ssh_key=yes
+
+ - name: (CloudLab) Set up extra disk space
+ shell: /usr/testbed/bin/mkextrafs /var/lib/uvtool/libvirt/images
+ creates=/var/lib/uvtool/libvirt/images/lost+found
+ when: cloudlab
+
+ - name: Add myself to libvirtd group
+ user: name={{ ansible_env['SUDO_USER'] }}
+ groups=libvirtd
+ append=yes
+
+ - name: Get trusty image for uvtool
+ shell: uvt-simplestreams-libvirt sync --source http://cloud-images.ubuntu.com/daily release=trusty arch=amd64
+
+ - name: Change the virbr0 subnet to {{ mgmt_net_prefix }}.0/24
+ template: src=templates/etc/libvirt/qemu/networks/default.xml.j2
+ dest=/etc/libvirt/qemu/networks/default.xml
+ notify:
+ - recreate default net
+
+ handlers:
+ - name: recreate default net
+ script: scripts/recreate-virbr0.sh
+
+# Play: create VMs to host OpenStack services
+- hosts: head
+ user: ubuntu
+ sudo: yes
+ tasks:
+ - name: Create VMs to host OpenCloud services
+ sudo: no
+ script: scripts/create-vms.sh
+
+ - include: tasks/vm-ips.yml
+
+ - name: Add VMs to /etc/hosts
+ template: src=templates/etc/hosts.j2
+ dest=/etc/hosts
+ notify:
+ - Reload dnsmasq
+
+ - name: Set up /etc/ansible/hosts
+ template: src=templates/etc/ansible/hosts.j2
+ dest=/etc/ansible/hosts
+
+ - name: Copy ansible.cfg to disable host key checking
+ sudo: no
+ copy: src=files/ansible.cfg
+ dest={{ ansible_env['PWD'] }}/.ansible.cfg
+
+ - name: Touch ~/.ssh/config
+ sudo: no
+ file: path={{ ansible_env['PWD'] }}/.ssh/config state=touch
+
+ - name: Disable host key checking in SSH
+ sudo: no
+ lineinfile: dest={{ ansible_env['PWD'] }}/.ssh/config
+ line="StrictHostKeyChecking no"
+
+ - name: Test that we can log into every VM
+ sudo: no
+ shell: ansible services -m ping -u ubuntu
+
+ handlers:
+ - name: Reload dnsmasq
+ shell: killall -HUP dnsmasq
+
+# Play: Install services using Juju
+- hosts: head
+ user: ubuntu
+ vars:
+ charm_src: /usr/local/src/charms/trusty
+ tasks:
+ - name: Initialize Juju
+ sudo: no
+ shell: juju generate-config
+ creates={{ ansible_env['PWD'] }}/.juju/environments.yaml
+
+ - shell: uvt-kvm ip juju
+ register: juju_ip
+
+ - name: Juju config file
+ sudo: no
+ template: src=templates/environments.yaml.j2
+ dest={{ ansible_env['PWD'] }}/.juju/environments.yaml
+
+ - name: Bootstrap Juju
+ sudo: no
+ shell: juju bootstrap
+ creates={{ ansible_env['PWD'] }}/.juju/environments/manual.jenv
+
+ - name: Copy openstack.cfg for Juju
+ sudo: yes
+ copy: src=files/openstack.cfg
+ dest=/usr/local/src/openstack.cfg
+
+ - name: Check for /usr/local/src/charms/trusty
+ sudo: yes
+ file: path={{ charm_src }}
+ state=directory
+ mode=0755
+
+ - name: Deploy OpenStack services with Juju
+ script: scripts/juju-setup.py
+
+ - name: Add all Juju relations between services
+ script: scripts/juju-relations.py
+
+ - name: Wait for relations to be fully added
+ script: scripts/wait-for-services.sh
+
+# Play: Use libvirt hooks to set up iptables
+- hosts: head
+ user: ubuntu
+ sudo: yes
+ tasks:
+ - name: Enable port forwarding for services
+ copy: src=files/{{ item }}
+ dest={{ item }}
+ mode=0755
+ notify:
+ - reload libvirt config
+ - run qemu hook
+ with_items:
+ - /etc/libvirt/hooks/daemon
+ - /etc/libvirt/hooks/qemu
+
+ handlers:
+ - name: reload libvirt config
+ shell: killall -HUP libvirtd
+
+ - name: run qemu hook
+ shell: /etc/libvirt/hooks/qemu start start
+
+# Play: Create credentials, set up some basic OpenStack
+- hosts: head
+ user: ubuntu
+ sudo: no
+ tasks:
+
+ - name: Get keystone admin password
+ shell: juju run --unit=keystone/0 "sudo cat /var/lib/keystone/keystone.passwd"
+ register: keystone_password
+
+ - shell: uvt-kvm ip keystone
+ register: keystone_ip
+
+ - name: Create credentials
+ template: src=templates/admin-openrc.sh.j2
+ dest={{ ansible_env['PWD'] }}/admin-openrc.sh
+
+ - name: (CloudLab) Make sure that /root/setup exists
+ file: path=/root/setup state=directory
+ sudo: yes
+ when: cloudlab
+
+ - name: (CloudLab) Copy credentials to /root/setup
+ shell: scp admin-openrc.sh /root/setup
+ sudo: yes
+ when: cloudlab
+
+ - name: Copy credentials to nova-cloud-controller
+ shell: "scp admin-openrc.sh ubuntu@nova-cloud-controller:"
+
+ - name: Copy network setup script
+ sudo: yes
+ copy: src=scripts/network-setup.sh
+ dest=/usr/local/src/network-setup.sh
+ mode=0644
+
+ - name: Run network setup script
+ shell: ansible nova-cloud-controller -m script -u ubuntu -a "/usr/local/src/network-setup.sh"
+
+ - name: Get public key
+ shell: cat {{ ansible_env['PWD'] }}/.ssh/id_rsa.pub
+ register: sshkey
+
+ - name: Copy CA certificate
+ shell: sudo juju scp nova-cloud-controller/0:/usr/local/share/ca-certificates/keystone_juju_ca_cert.crt /usr/local/share/ca-certificates
+ creates=/usr/local/share/ca-certificates/keystone_juju_ca_cert.crt
+
+ - name: Update CA ca-certificates
+ shell: update-ca-certificates
+ sudo: yes
+
+- hosts: compute
+ user: ubuntu
+ sudo: yes
+ vars:
+ control_net: "{{ hostvars['head']['ansible_virbr0']['ipv4']['network'] }}/24"
+ gateway: "{{ hostvars['head']['ansible_default_ipv4']['address'] }}"
+ tasks:
+ - name: Install package needed by Juju
+ apt: name=python-yaml state=present
+
+ - name: Add key
+ authorized_key: user="{{ ansible_env['SUDO_USER'] }}"
+ key="{{ hostvars['head']['sshkey']['stdout'] }}"
+
+ - name: Add route via /etc/rc.local
+ template: src=templates/etc/rc.local.cloudlab
+ dest=/etc/rc.local
+ mode=0755
+ when: cloudlab
+ notify:
+ - run /etc/rc.local
+
+ - name: Add route via /etc/rc.local
+ template: src=templates/etc/rc.local
+ dest=/etc/rc.local
+ mode=0755
+ when: not cloudlab
+ notify:
+ - run /etc/rc.local
+
+ - name: Touch ~/.ssh/config
+ file: path=/var/lib/nova state=directory
+
+ - name: (CloudLab) Set up extra disk space
+ shell: /usr/testbed/bin/mkextrafs /var/lib/nova
+ creates=/var/lib/nova/lost+found
+ when: cloudlab
+
+ handlers:
+ - name: run /etc/rc.local
+ shell: /etc/rc.local
diff --git a/scripts/compute-ext-net.sh b/scripts/compute-ext-net.sh
index af0d2a2..762d37f 100755
--- a/scripts/compute-ext-net.sh
+++ b/scripts/compute-ext-net.sh
@@ -9,3 +9,4 @@
ifconfig veth1 up
brctl addif databr veth0
iptables -t nat -A POSTROUTING -s 10.168.0.0/24 \! -d 10.168.0.0/24 -j MASQUERADE
+sysctl -w net.ipv4.ip_forward=1
diff --git a/scripts/create-vms-cord.sh b/scripts/create-vms-cord.sh
index dc19da7..10c69d8 100755
--- a/scripts/create-vms-cord.sh
+++ b/scripts/create-vms-cord.sh
@@ -59,7 +59,7 @@
create-vm onos-fabric 2 4096 40
if $TESTING
then
- create-vm nova-compute 2 4096 100
+ create-vm nova-compute 6 16384 240
fi
# Wait for everything to get set up