blob: 5fc831cd67a4fb28275a0741aabf37a9df0d67f3 [file] [log] [blame]
Jack Lucas230ae892018-03-27 00:04:46 -04001#!/bin/bash
2# Install DCAE via Cloudify Manager
3# Expects:
4# CM address (IP or DNS) in CMADDR environment variable
5# CM password in CMPASS environment variable (assumes user is "admin")
Jack Lucas53f31102018-04-02 20:55:04 +00006# Consul address with port in CONSUL variable
Jack Lucas230ae892018-03-27 00:04:46 -04007# Plugin wagon files in /wagons
Jack Lucas53f31102018-04-02 20:55:04 +00008# Blueprints for components to be installed in /blueprints
9# Input files for components to be installed in /inputs
10# Configuration JSON files that need to be loaded into Consul in /dcae-configs
Jack Lucas230ae892018-03-27 00:04:46 -040011
Jack Lucas53f31102018-04-02 20:55:04 +000012set -ex
Jack Lucas230ae892018-03-27 00:04:46 -040013
Jack Lucas53f31102018-04-02 20:55:04 +000014CBS_REG='{"ID": "dcae-cbs0", "Name": "config_binding_service", "Address": "config-binding-service", "Port": 10000}'
Jack Lucas230ae892018-03-27 00:04:46 -040015# Deploy components
16# $1 -- name (for bp and deployment)
17# $2 -- blueprint name
18# $3 -- inputs file name
19function deploy {
20 cfy install -b $1 -d $1 -i /inputs/$3 /blueprints/$2
21}
22# Set up profile to access CMs
23cfy profiles use -u admin -t default_tenant -p "${CMPASS}" "${CMADDR}"
24
25# Output status, for debugging purposes
26cfy status
27
Jack Lucas53f31102018-04-02 20:55:04 +000028# Load configurations into Consul
29for config in /dcae-configs/*.json
30do
31 # The basename of the file is the Consul key
32 key=$(basename ${config} .json)
33 # Strip out comments, empty lines
34 egrep -v "^#|^$" ${config} > /tmp/dcae-upload
35 curl -v -X PUT -H "Content-Type: application/json" --data-binary @/tmp/dcae-upload ${CONSUL}/v1/kv/${key}
36done
37
38# For backward compatibility, load config_binding_service into Consul as service
39curl -v -X PUT -H "Content-Type: application/json" --data "${CBS_REG}" ${CONSUL}/v1/agent/service/register
40
Jack Lucas230ae892018-03-27 00:04:46 -040041# Load plugins onto CM
Jack Lucas53f31102018-04-02 20:55:04 +000042# Allow "already loaded" error
43# (If there are other problems, will
44# be caught in deployments.)
45set +e
Jack Lucas230ae892018-03-27 00:04:46 -040046for wagon in /wagons/*.wgn
47do
48 cfy plugins upload ${wagon}
49done
Jack Lucas53f31102018-04-02 20:55:04 +000050set -e
Jack Lucas230ae892018-03-27 00:04:46 -040051
52# Deploy platform components
53deploy config_binding_service k8s-config_binding_service.yaml k8s-config_binding_service-inputs.yaml
54deploy inventory k8s-inventory.yaml k8s-inventory-inputs.yaml
55deploy deployment_handler k8s-deployment_handler.yaml k8s-deployment_handler-inputs.yaml
56deploy policy_handler k8s-policy_handler.yaml k8s-policy_handler-inputs.yaml
57
Jack Lucas53f31102018-04-02 20:55:04 +000058# Display deployments, for debugging purposes
59cfy deployments list