Merge "Updated Platform install internals readme"
diff --git a/build.gradle.new b/build.gradle.new
new file mode 100644
index 0000000..f72dd13
--- /dev/null
+++ b/build.gradle.new
@@ -0,0 +1,300 @@
+/*
+ * 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.
+ */
+
+import org.opencord.gradle.rules.*
+import org.yaml.snakeyaml.Yaml
+
+allprojects {
+ apply plugin: 'base'
+ apply plugin: 'de.gesellix.docker'
+ //apply plugin: 'com.tmiyamon.config'
+
+ docker {
+ // dockerHost = System.env.DOCKER_HOST ?: 'unix:///var/run/docker.sock'
+ // dockerHost = System.env.DOCKER_HOST ?: 'https://192.168.99.100:2376'
+ // certPath = System.getProperty('docker.cert.path') ?: "${System.getProperty('user.home')}/.docker/machine/machines/default"
+ // authConfigPlain = [
+ // "username" : "joe",
+ // "password" : "some-pw-as-needed",
+ // "email" : "joe@acme.com",
+ // "serveraddress" : "https://index.docker.io/v1/"
+ // ]
+ }
+}
+
+ext {
+
+ // Upstream registry to simplify filling out the comps table below
+ upstreamReg = project.hasProperty('upstreamReg') ? project.getProperty('upstreamReg') : 'docker.io'
+
+ // Target registry to be used to publish docker images needed for deployment
+ targetReg = project.hasProperty('targetReg') ? project.getProperty('targetReg') : 'localhost:5000'
+
+ // The tag used to tag the docker images push to the target registry
+ targetTag = project.hasProperty('targetTag') ? project.getProperty('targetTag') : 'candidate'
+
+ // Component table
+ comps = [
+ ]
+
+ // Deployment target config file (yaml format); this can be overwritten from the command line
+ // using the -PdeployConfig=<file-path> syntax.
+ deployConfig = project.hasProperty('deployConfig') ? project.getProperty('deployConfig') : './config/default.yml'
+
+}
+
+task copyAnsibleInventory(type: Copy) {
+ File configFile = new File(deployConfig)
+ def yaml = new Yaml()
+ def config = yaml.load(configFile.newReader())
+
+ from 'inventory/templates/single-prod'
+ into 'inventory'
+ expand([
+ prod: config.seedServer.ip,
+ ])
+}
+
+// ------------- PlaceHolders ----------------
+
+task updateDocker (type: Exec) {
+ commandLine 'sudo', 'utils/enable-remote-docker-registry', "$targetReg"
+}
+
+task prime {
+ // TODO this is a place-holder.
+ // dependsOn updateDocker
+ doFirst {
+ println "Using deployment config: $deployConfig"
+ File configFile = new File(deployConfig)
+ def yaml = new Yaml()
+ def config = yaml.load(configFile.newReader())
+ println "Config: $config"
+ println "Access some data in config:\n\tSeed server IP=${config.seedServer.ip}"
+ }
+}
+
+// ---------------- 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 fetch << {
+ logger.info 'Platform install has nothing to fetch'
+}
+
+task buildImages << {
+ logger.info 'Platform install has nothing to build'
+}
+
+task publishImages {
+ comps.each { name, spec -> if (spec.type == 'image') { dependsOn "publish" + name } }
+}
+
+task publish {
+ dependsOn publishImages
+}
+
+tasks.addRule(new DockerFetchRule(project))
+tasks.addRule(new DockerPublishRule(project))
+tasks.addRule(new DockerTagRule(project))
+tasks.addRule(new GitSubmoduleUpdateRule(project))
+
+task deployPlatform (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-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"
+}
+
+task postDeployTests (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-post-deploy-playbook.yml"
+}
+
diff --git a/roles/head-prologue/tasks/main.yml b/roles/head-prologue/tasks/main.yml
index a8b4f2b..9a5464d 100644
--- a/roles/head-prologue/tasks/main.yml
+++ b/roles/head-prologue/tasks/main.yml
@@ -25,6 +25,7 @@
- proxy_http
- proxy_wstunnel
- rewrite
+ - headers
- name: Enable CORD Apache Configuration
become: yes