Merge "updated to support the enlisting of compute nodes into juju and XOS when they come on line"
diff --git a/INSTALL_SINGLE_NODE.md b/INSTALL_SINGLE_NODE.md
new file mode 100644
index 0000000..17a9718
--- /dev/null
+++ b/INSTALL_SINGLE_NODE.md
@@ -0,0 +1,107 @@
+# Installing a CORD POD on a Single Physical Host
+[*This description is for bringing up a CORD POD on virtual machines on a single physical host. The purpose
+of this solution is to enable those interested in understanding how CORD works to examine and interact with a running CORD environment.*]
+
+This tutorial walks you through the steps to bring up a CORD "POD" on a single server using multiple virtual machines.
+
+## What you need (Prerequisites)
+You will need a build machine (can be your developer laptop) and a target server.
+
+Build host:
+* Mac OS X, Linux, or Windows with a 64-bit OS
+* [`git`](https://git-scm.com/) (2.5.4 or later)
+* [`Vagrant`](https://www.vagrantup.com/) (1.8.1 or later)
+* Access to the Internet
+* SSH access to the target server
+
+Target server:
+* Fresh install of Ubuntu 14.04 LTS with latest updates
+* Minimum 12 CPU cores, 48GB RAM, 1TB disk
+* Access to the Internet
+* Account used to SSH from build host has password-less *sudo* capability
+
+### Running on CloudLab (optional)
+If you do not have a target server available, you can borrow one on
+[CloudLab](https://www.cloudlab.us). Sign up for an account using your organization's
+email address and choose "Join Existing Project"; for "Project Name" enter `cord-testdrive`.
+
+[*Note: CloudLab is supporting CORD as a courtesy. It is expected that you will
+not use CloudLab resources for purposes other than evaluating CORD. If, after a
+week or two, you wish to continue using CloudLab to experiment with or develop CORD,
+then you must apply for your own separate CloudLab project.*]
+
+Once your account is approved, start an experiment using the `OnePC-Ubuntu14.04.4` profile
+on either the Wisconsin or Clemson cluster. This will provide you with a temporary target server
+meeting the above requirements.
+
+Refer to the [CloudLab documentation](https://docs.cloudlab.us) for more information.
+
+## Bring up the developer environment
+On the build host, clone the
+[`platform-install`](https://gerrit.opencord.org/platform-install) repository
+anonymously and switch into its top directory:
+
+```
+git clone https://gerrit.opencord.org/platform-install
+cd platform-install
+```
+
+Bring up the development Vagrant box. This will take a few minutes, depending on your
+connection speed:
+
+```
+vagrant up
+```
+
+Login to the Vagrant box:
+
+```
+vagrant ssh
+```
+
+Switch to the `platform-install` directory.
+
+```
+cd /platform-install
+```
+
+## Prepare the configuration file
+
+Edit the configuration file `config/default.yml`. Add the IP address of your target
+server as well as the username / password for accessing the server.
+
+If your target server is a CloudLab machine, uncomment the following two lines in the
+configuration file:
+
+```
+#extraVars:
+# - 'on_cloudlab=True'
+```
+
+## Deploy the single-node CORD POD on the target server
+
+Deploy the CORD software to the the target server and configure it to form a running POD.
+
+```
+./gradlew deploySingle
+```
+> *What this does:*
+>
+> This command uses an Ansible playbook (cord-single-playbook.yml) to install
+> OpenStack services, ONOS, and XOS in VMs on the target server. It also brings up
+> a compute node as a VM.
+>
+> (You *could* also run the above Ansible playbook directly, but Gradle is the
+> top-level build tool of CORD and so we use it here for consistency.)
+
+Note that this step usually takes *at least an hour* to complete. Be patient!
+
+Once the above step completes, you can log into XOS as follows:
+
+* URL: `http://<target-server>/`
+* Username: `padmin@vicci.org`
+* Password: `letmein`
+
+[*STILL TO DO*]:
+* Port forwarding for XOS login as described above
+* Add pointer to where to go next. At this point the services are all in place, but the vSG has not been created yet.
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..ded4f63
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2016 Open Networking Laboratory
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/README.md b/README.md
index 43d4dc7..5bdf200 100644
--- a/README.md
+++ b/README.md
@@ -1,155 +1,9 @@
# platform-install
This repository contains [Ansible](http://docs.ansible.com) playbooks for
-installing and configuring an OpenStack Kilo cluster for use with XOS. This is
-how we build clusters for [OpenCloud](http://opencloud.us), and is the method
-of installing a [CORD](http://cord.onosproject.org) development POD as well.
+installing and configuring software components on a CORD POD: OpenStack, ONOS,
+and XOS. It is a sub-module of the [main CORD repository](https://github.com/opencord/cord).
-All of the OpenStack controller services are installed in VMs on a single "head
-node" and connected by an isolated private network.
-[Juju](http://www.ubuntu.com/cloud/tools/juju) is used to install and configure
-the OpenStack services.
+To install a single-node CORD POD, read [INSTALL_SINGLE_NODE.md](./INSTALL_SINGLE_NODE.md).
-## Prerequisites (OpenCloud and CORD)
-
-* *Set up control machine:* The install playbooks in this repository can either run on a
- separate control machine (e.g., a laptop) or on the cluster head node. Either way:
- * Install a recent version of Ansible (Ansible 1.9.x on Mac OS X or Ubuntu should work).
- * Be able to login to all of the cluster servers from the control machine using SSH.
-* *Set up servers:* One server in the cluster will be the "head" node, running the OpenStack
- services. The rest will be "compute" nodes.
- * Install Ubuntu 14.04 LTS on all servers.
- * The user account used to login from the control machine must have *sudo* access.
- * Each server should have a single active NIC (preferably eth0) with connectivity to the
- Internet.
-
-## How to install a CORD POD
-
-The CORD POD install procedure uses the "head node" of the cluster as the
-control machine for the install. As mentioned above, install Ansible on the
-head node and check out this repository.
-
-The playbooks assume that a bridge called *mgmtbr* on the head node is
-connected to the management network. Note that also there must be a DHCP
-server on the management network that:
-
- 1. hands out IP addresses to VMs connected to *mgmtbr*
- 2. resolves VM names to IP addresses
- 3. is configured as a resolver on the head and compute nodes
-
-If you need to set up `dnsmasq` to do this,
-take a look at [this example configuration](files/etc/dnsmasq.d/cord).
-Then follow these steps:
-
-* Run the `bootstrap.sh` script to install Ansible and set up keys for login
- via `localhost`
-* Edit *cord-hosts* with the DNS names of your compute nodes, and update the
- *ansible_ssh_user* variable appropriately. Before proceeding, these commands
- needs to work on the head node:
-
-```
-$ ansible -i cord-hosts head -m ping
-$ ansible -i cord-hosts compute -m ping
-```
-
-* 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`. 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>`
-
-This 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. Configuring and running XOS and ONOS in these VMs is beyond the scope of
-this README.
-
-*NOTE:* The install process only brings up a single nova-compute node. To
-bring up more nodes as compute nodes, perform these steps on the head node:
-
-```
-$ juju add-machine ssh:<user>@<compute-host>
-$ juju add-unit nova-compute --to <juju-machine-id>
-```
-
-Refer to the [Juju documentation](https://jujucharms.com/docs/stable/config-manual)
-for more information.
-
-### Caveats
-
-* The goal is to configure HA for the OpenStack services, but this is not yet implemented.
-
-## How to install a single-node CORD test environment on CloudLab
-
-Setting up a single-node CORD environment is simple.
-
-* Start a CloudLab experiment using profile *OnePC-Ubuntu14.04.4* and login to
- the node
-* `wget
- https://raw.githubusercontent.com/opencord/platform-install/master/scripts/single-node-pod.sh`
-* `bash single-node-pod.sh [-t] [-e]`
- * With no options, the script installs the OpenStack services and a simulated
- fabric. It creates VMs for XOS and ONOS but does not start these services.
- * Adding the `-t` option will start XOS, bring up a vSG, install a test
- client, and run a simple E2E test.
- * Adding the `-e` option will add the
- [ExampleService](http://guide.xosproject.org/devguide/exampleservice/) to
- XOS (and test it if `-t` is also specified).
-
-As mentioned above, be patient! With a fast Internet connection, the entire
-process will take at least one hour to complete.
-
-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. A server with at least 12
-cores and 48GB RAM is recommended.
-
-
-## How to install an OpenCloud cluster
-
-Once the prerequisites are satisfied, here are the basic steps for installing a
-new OpenCloud cluster named 'foo':
-
-* Create *foo-setup.yml* and *foo-compute.yml* files using *cloudlab-setup.yml*
- and *cloudlab-compute.yml* as templates. Create a *foo-hosts* file with the
- DNS names of your nodes based on *cloudlab-hosts*.
-* If you are **not** installing on CloudLab, edit *foo-hosts* and add
- *cloudlab=False* under *[all:vars]*.
-* If you are installing a cluster for inclusion in the **public OpenCloud**,
- change *mgmt_net_prefix* in *foo-setup.yml* to be unique across all OpenCloud
- clusters.
-* To set up Juju, use it to install the OpenStack services on the head node,
- and prep the compute nodes, run on the head node: ``` $ ansible-playbook -i
- foo-hosts foo-setup.yaml ```
-* Log into the head node. For each compute node, put it under control of Juju,
- e.g.: ``` $ juju add-machine ssh:ubuntu@compute-node ```
-* To install the *nova-compute* service on the compute nodes that were added to
- Juju, run on the control machine: ``` $ ansible-playbook -i foo-hosts
- foo-compute.yaml ```
-
-### Caveats
-
-* The installation configures port forwarding so that the OpenStack services
- can be accessed from outside the private network. Some OpenCloud-specific
- firewalling is also introduced, which will likely require modification for
- other setups. See:
- [files/etc/libvirt/hooks/qemu](https://github.com/andybavier/opencloud-cluster-setup/blob/master/files/etc/libvirt/hooks/qemu).
-* By default the compute nodes are controlled and updated automatically using
- *ansible-pull* from [this
- repo](https://github.com/andybavier/opencloud-nova-compute-ansible). You may
- want to change this.
-* All of the service interfaces are configured to use SSL because that's what
- OpenCloud uses in production. To turn this off, look for the relevant Juju
- commands in *cloudlab-setup.yaml*.
-
+Otherwise you should start with the [CORD repository](https://github.com/opencord/cord).
diff --git a/Vagrantfile b/Vagrantfile
new file mode 100644
index 0000000..5db90c5
--- /dev/null
+++ b/Vagrantfile
@@ -0,0 +1,28 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+Vagrant.configure(2) do |config|
+
+ if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
+ config.vm.synced_folder ".", "/platform-install", mount_options: ["dmode=700,fmode=600"]
+ else
+ config.vm.synced_folder ".", "/platform-install"
+ end
+
+ config.vm.define "platdev" do |d|
+ d.ssh.forward_agent = true
+ d.vm.box = "ubuntu/trusty64"
+ d.vm.hostname = "platdev"
+ d.vm.network "private_network", ip: "10.100.198.200"
+ d.vm.provision :shell, path: "scripts/bootstrap_ansible.sh"
+ d.vm.provision :shell, inline: "PYTHONUNBUFFERED=1 ansible-playbook /platform-install/ansible/platdev.yml -c local"
+ d.vm.provider "virtualbox" do |v|
+ v.memory = 2048
+ end
+ end
+
+ if Vagrant.has_plugin?("vagrant-cachier")
+ config.cache.scope = :box
+ end
+
+end
diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg
new file mode 100644
index 0000000..bd331b2
--- /dev/null
+++ b/ansible/ansible.cfg
@@ -0,0 +1,9 @@
+[defaults]
+callback_plugins=/etc/ansible/callback_plugins/
+host_key_checking=False
+deprecation_warnings=False
+
+[privilege_escalation]
+become=True
+become_method=sudo
+become_user=root
diff --git a/ansible/platdev.yml b/ansible/platdev.yml
new file mode 100644
index 0000000..d3a34fc
--- /dev/null
+++ b/ansible/platdev.yml
@@ -0,0 +1,7 @@
+- hosts: localhost
+ remote_user: vagrant
+ serial: 1
+ roles:
+ - common
+ - java8-oracle
+ - buildtools
diff --git a/ansible/roles/buildtools/defaults/main.yml b/ansible/roles/buildtools/defaults/main.yml
new file mode 100644
index 0000000..b7568df
--- /dev/null
+++ b/ansible/roles/buildtools/defaults/main.yml
@@ -0,0 +1,2 @@
+apt_packages:
+ - maven
diff --git a/ansible/roles/buildtools/tasks/main.yml b/ansible/roles/buildtools/tasks/main.yml
new file mode 100644
index 0000000..6c0e3fa
--- /dev/null
+++ b/ansible/roles/buildtools/tasks/main.yml
@@ -0,0 +1,6 @@
+- name: Apt packages
+ apt:
+ name: "{{ item }}"
+ with_items: "{{ apt_packages }}"
+ tags: [buildtools]
+
diff --git a/ansible/roles/common/defaults/main.yml b/ansible/roles/common/defaults/main.yml
new file mode 100644
index 0000000..4aa8032
--- /dev/null
+++ b/ansible/roles/common/defaults/main.yml
@@ -0,0 +1,13 @@
+hosts: [
+ { host_ip: "10.100.198.200", host_name: "platdev"},
+]
+
+use_latest_for:
+ - debian-keyring
+ - debian-archive-keyring
+ - rng-tools
+ - python-netaddr
+
+obsolete_services:
+ - puppet
+ - chef-client
diff --git a/ansible/roles/common/files/ssh_config b/ansible/roles/common/files/ssh_config
new file mode 100644
index 0000000..990a43d
--- /dev/null
+++ b/ansible/roles/common/files/ssh_config
@@ -0,0 +1,3 @@
+Host *
+ StrictHostKeyChecking no
+ UserKnownHostsFile=/dev/null
diff --git a/ansible/roles/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml
new file mode 100644
index 0000000..3ee9d2e
--- /dev/null
+++ b/ansible/roles/common/tasks/main.yml
@@ -0,0 +1,40 @@
+- name: JQ is present
+ apt:
+ name: jq
+ force: yes
+ tags: [common]
+
+- name: Host is present
+ lineinfile:
+ dest: /etc/hosts
+ regexp: "^{{ item.host_ip }}"
+ line: "{{ item.host_ip }} {{ item.host_name }}"
+ with_items: "{{ hosts }}"
+ tags: [common]
+
+- name: Latest apt packages
+ apt:
+ name: "{{ item }}"
+ with_items: "{{ use_latest_for }}"
+ tags: [common]
+
+- name: Services are not running
+ service:
+ name: "{{ item }}"
+ state: stopped
+ ignore_errors: yes
+ with_items: "{{ obsolete_services }}"
+ tags: [common]
+
+- name: Ensure known_hosts file is absent
+ file:
+ path: /home/vagrant/.ssh/known_hosts
+ state: absent
+
+- name: Disable Known Host Checking
+ copy:
+ src: files/ssh_config
+ dest: /home/vagrant/.ssh/config
+ owner: vagrant
+ group: vagrant
+ mode: 0600
diff --git a/ansible/roles/java8-oracle/tasks/main.yml b/ansible/roles/java8-oracle/tasks/main.yml
new file mode 100644
index 0000000..809fbee
--- /dev/null
+++ b/ansible/roles/java8-oracle/tasks/main.yml
@@ -0,0 +1,20 @@
+---
+- name: Install add-apt-repository
+ sudo: yes
+ apt: name=software-properties-common state=latest
+
+- name: Add Oracle Java repository
+ sudo: yes
+ apt_repository: repo='ppa:webupd8team/java'
+
+- name: Accept Java 8 license
+ sudo: yes
+ debconf: name='oracle-java8-installer' question='shared/accepted-oracle-license-v1-1' value='true' vtype='select'
+
+- name: Install Oracle Java 8
+ sudo: yes
+ apt: name={{item}} state=latest
+ with_items:
+ - oracle-java8-installer
+ - ca-certificates
+ - oracle-java8-set-default
diff --git a/build.gradle b/build.gradle
index 867e73e..8bde489 100644
--- a/build.gradle
+++ b/build.gradle
@@ -89,6 +89,35 @@
// ---------------- Useful tasks ----------------
+List.metaClass.asParam = { prefix, sep ->
+ if (delegate.size() == 0) {
+ ""
+ }
+ String result = "--" + prefix + "="
+ String p = ""
+ delegate.each {
+ result += p + "${it}"
+ p = sep
+ }
+ result
+}
+
+List.metaClass.p = { value, name ->
+ if (value != null && value != "") {
+ delegate << name + "=" + value
+ } else {
+ delegate
+ }
+}
+
+List.metaClass.p = { spec ->
+ if (spec != null && spec != "") {
+ delegate += spec
+ } else {
+ delegate
+ }
+}
+
task fetchUpstreamImages {
comps.each { name, spec -> if (spec.type == 'image') { dependsOn "fetch" + name } }
}
@@ -167,3 +196,57 @@
args = args.p(skipTags.asParam("skip-tags", ",")).p(extraVars.asParam("extra-vars", " ")) << "cord-head-playbook.yml"
}
+
+task deploySingle (type: Exec) {
+ dependsOn copyAnsibleInventory
+
+ println "Using deployment config: $deployConfig"
+ File configFile = new File(deployConfig)
+ def yaml = new Yaml()
+ def config = yaml.load(configFile.newReader())
+
+ executable = "ansible-playbook"
+ args = ["-i", "inventory/single-prod"]
+
+ if ( config.seedServer.user != null && config.seedServer.user != "" ) {
+ args = args << "--user=$config.seedServer.user"
+ }
+
+ def extraVars = []
+ if (config.seedServer) {
+ extraVars = extraVars.p(config.seedServer.extraVars)
+ .p(config.seedServer.password, "ansible_ssh_pass")
+ .p(config.seedServer.sudoPassword, "ansible_sudo_pass")
+ .p(config.seedServer.fabric_ip, "fabric_ip")
+ .p(config.seedServer.management_ip, "management_ip")
+ .p(config.seedServer.management_network, "management_network")
+ .p(config.seedServer.management_iface, "management_iface")
+ .p(config.seedServer.external_ip, "external_ip")
+ .p(config.seedServer.external_network, "external_network")
+ .p(config.seedServer.external_iface, "external_iface")
+ .p(config.seedServer.fabric_ip, "fabric_ip")
+ .p(config.seedServer.fabric_network, "fabric_network")
+ .p(config.seedServer.fabric_iface, "fabric_iface")
+ .p(config.seedServer.domain, "domain")
+ .p(config.seedServer.virtualbox_support, "virtualbox_support")
+ .p(config.seedServer.power_helper_user, "power_helper_user")
+ .p(config.seedServer.power_helper_host, "power_helper_host")
+ .p(config.seedServer.port, "ansible_ssh_port")
+ }
+
+ if (config.otherServers) {
+ extraVars = extraVars.p(config.otherServers.location, "prov_location")
+ .p(config.otherServers.rolesPath, "prov_role_path")
+ .p(config.otherServers.role, "prov_role")
+ }
+
+ if (config.docker) {
+ extraVars = extraVars.p(config.docker.registry, "docker_registry")
+ .p(config.docker.imageVersion, "docker_image_version")
+ }
+
+ def skipTags = [].p(config.seedServer.skipTags)
+
+ args = args.p(skipTags.asParam("skip-tags", ",")).p(extraVars.asParam("extra-vars", " ")) << "cord-single-playbook.yml"
+}
+
diff --git a/config/onlab_develop_pod.yml b/config/cloudlab.yml
similarity index 72%
rename from config/onlab_develop_pod.yml
rename to config/cloudlab.yml
index f095e6c..104eaca 100644
--- a/config/onlab_develop_pod.yml
+++ b/config/cloudlab.yml
@@ -1,11 +1,20 @@
-# Deployment configuration for a phyical hardware POD
+# Deployment configuration for a single-node physical hardware POD
---
seedServer:
- ip: '10.90.0.2'
+
+ # Put the IP of your CloudLab node here
+ ip: '128.104.222.83'
+
# User name and password used by Ansible to connect to the host for remote
- # provisioning
- user: 'admin'
+ # provisioning. Put your CloudLab username here; also add your password or
+ # run ssh-agent to allow for password-less SSH login.
+ user: 'acb'
password: 'onos_test'
+
+ #
+ # *** For a single-node pod on CloudLab, you don't need to change anything below here ***
+ #
+
# Network address information for the head node:
#
# fabric_ip - the IP address and mask bits to be used to configure the network
@@ -20,13 +29,14 @@
# interface connecting the head node (and the POD) to the
# Internet. All traffic in the POD to external hosts will be
# NAT-ed through this interface
- fabric_ip: '10.6.1.1/24'
management_ip: '10.6.0.1/24'
- external_ip: '47.135.132.21/24'
- management_iface: 'em2'
- external_iface: 'em1'
+ management_iface: 'eth2'
+ external_iface: 'eth0'
skipTags:
- 'interface_config'
+ - 'switch_support'
+ extraVars:
+ - 'on_cloudlab=True'
docker:
imageVersion: candidate
diff --git a/config/default.yml b/config/default.yml
index 0be591e..68fe747 100644
--- a/config/default.yml
+++ b/config/default.yml
@@ -1,47 +1,15 @@
-# Deployment configuration for VirtualBox based head node.
-#
-# This deployment configuration can be utilized with the head node created
-# via `vargrant up headnode` from the gerrit.opencord.org/maas repository.
+# Deployment configuration for a single-node physical hardware POD
---
seedServer:
- ip: '10.100.198.201'
- # User name and password used by Ansible to connect to the host for remote
- # provisioning
- user: 'vagrant'
- password: 'vagrant'
+ # Put the IP of your target server here
+ ip: '1.2.3.4'
- # Specifies tasks within the head node provisioning not to execute, including:
- #
- # switch_support - don't download the switch ONL images as there are no
- # switches in this configuration
- # interface_config - don't update the network configuration of the headnode
- # as it is configured by vagrant to the proper settings
- skipTags:
- - 'switch_support'
- - 'interface_config'
+ # User name and password used by Ansible to connect to the target server for remote
+ # provisioning. You can also run ssh-agent to allow for password-less SSH login.
+ user: 'myuser'
+ password: 'cord_test'
- management_ip: '10.1.0.1/24'
- management_iface: 'eth2'
- external_iface: 'eth0'
- management_network: '10.1.0.0/24'
-
- # Specifies the extra settings required for this configuration
- #
- # virtualbox_support - install support for managing virtual box based
- # compute nodes
- virtualbox_support: 1
- power_helper_user: 'cord'
-
-docker:
- imageVersion: candidate
-
-otherServers:
- # Specifies the configuration for dynamically added compute nodes
- location: 'http://gerrit.opencord.org/maas'
- rolesPath: 'roles'
- role: 'compute-node'
- fabric:
- network: '10.1.1.1/24'
- range_low: '10.1.1.2'
- range_high: '10.1.1.253'
+ # Uncomment if the target server is a CloudLab machine
+ #extraVars:
+ # - 'on_cloudlab=True'
diff --git a/cord-compute-playbook.yml b/cord-compute-playbook.yml
index b0f191e..0176226 100644
--- a/cord-compute-playbook.yml
+++ b/cord-compute-playbook.yml
@@ -12,7 +12,7 @@
hosts: all
become: yes
roles:
- - { role: dns-configure, when: on_cloudlab }
+ - { role: dns-configure, when: not cord_provisioned }
- name: Prep systems
hosts: compute
diff --git a/cord-head-playbook.yml b/cord-head-playbook.yml
index 6b01f1f..0f7b930 100644
--- a/cord-head-playbook.yml
+++ b/cord-head-playbook.yml
@@ -15,15 +15,15 @@
hosts: head
become: yes
roles:
- - { role: dns-nsd, when: on_cloudlab }
- - { role: dns-unbound, when: on_cloudlab }
+ - { role: dns-nsd, when: not cord_provisioned }
+ - { role: dns-unbound, when: not cord_provisioned }
- apt-cacher-ng
- name: Configure all hosts to use DNS server
hosts: all
become: yes
roles:
- - { role: dns-configure, when: on_cloudlab }
+ - { role: dns-configure, when: not cord_provisioned }
- name: Prep systems
hosts: all
diff --git a/cord-single-playbook.yml b/cord-single-playbook.yml
index ee657e9..ed1f648 100644
--- a/cord-single-playbook.yml
+++ b/cord-single-playbook.yml
@@ -9,7 +9,7 @@
tasks:
- include_vars: vars/cord_single_defaults.yml
- include_vars: vars/cord.yml
- - include_vars: vars/cord_keystone.yml
+ - include_vars: vars/example_keystone.yml
- name: DNS Server and apt-cacher-ng Setup
hosts: head
diff --git a/gradle.properties b/gradle.properties
index 1a644c7..c955ae8 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1 +1,4 @@
org.gradle.daemon=true
+
+# Uncomment for running on CloudLab
+#deployConfig=/platform-install/config/cloudlab.yml
diff --git a/roles/test-client-install/files/test-client-playbook.yml b/roles/test-client-install/files/test-client-playbook.yml
index ab17491..fa13250 100644
--- a/roles/test-client-install/files/test-client-playbook.yml
+++ b/roles/test-client-install/files/test-client-playbook.yml
@@ -22,5 +22,4 @@
- name: Create testclient
become: yes
- command: lxc-create -t ubuntu -n testclient
-
+ shell: lxc-ls | grep testclient || lxc-create -t ubuntu -n testclient
diff --git a/scripts/bootstrap_ansible.sh b/scripts/bootstrap_ansible.sh
new file mode 100755
index 0000000..5dce4b2
--- /dev/null
+++ b/scripts/bootstrap_ansible.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# Copyright 2012 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+set -e
+
+echo "Installing Ansible..."
+apt-get install -y software-properties-common
+apt-add-repository ppa:ansible/ansible
+apt-get update
+apt-get install -y ansible
+cp /platform-install/ansible.cfg /etc/ansible/ansible.cfg
+