INIT Examples

Onboarding CPS vDRA on OpenStack Using ESC

Before configuring ESC to launch CPS vDRA VNF, ensure that below requirements are fulfilled.

  • The qcow2 image has been onboarded on OpenStack.

  • Identify the names of deployment in data model, VM groups, flavors and image name.

  • Network – Identify the network (internal, external, management, IPs, subnets, interface IDs, DHCP pool etc.) that are going to be used for various VMs, and make sure that these networks are configured in OpenStack.

  • The configuration data – Identify the initial configuration for a given type of VM, and nature of the VM (e.g. master, control etc.). Also, from where the configuration is to be loaded.

Master Cloud Init Example

#cloud-config
debug: True
output: {all: '| tee -a /var/log/cloud-init-output.log'}

users:
  - name: cps
    sudo: ['ALL=(ALL) NOPASSWD:ALL']
    groups: docker
    ssh-authorized-keys:
      - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDzjJjndIvUiBt
a4VSIbd2gJmlMWcQ8wtejgAbiXtoFZdtMdo9G0ZDEOtxHNNDPwWujMiYAkZh
ZWX/zON9raavU8lgD9+YcRopWUtujIC71YjtoxIjWIBBbrtqtPlUXMUXQsi91
RQbUtslENP+tSatS3awoQupyBMMSutyBady/7Wq0UTwFsnYs5Jfs8jIQuMfV
Q9uJ4mNn7wJ0N+Iaf27rE0t3oiY5DRN6j07WhauM6lCnZ1JDlzqmTnTHQkg
J3uKmQa5x73tJ1OW89Whf+R+dfslVn/yUwK/vf4extHTn32Dtsxkjz7kQeED
gCe/y7owimaEFcCIfEWEaj/50jegN cps@root-public-key
chpasswd:
  list: |
    cps:cisco123
  expire: False
write_files:
  - path: /root/swarm.json
    content: |
      {
        "role": "master",
        "identifier": "master-0",
        "master": "172.16.2.11",
        "network": "172.16.2.0/24",
        "registry": "172.16.2.11:5000",
        "consul": "172.16.2.11:8500",
        "reinitialize_data": "1",
        "zing": "1",
        "tenant": "esc",
        "weavePw": "cisco123",
        "esc": "172.18.11.122",
        "escUser": "admin",
        "escPw": "admin",
        "scheduler": "ha",
        "deployment_name": "docker-pcrf",
        "init": "cisco-policy-pcrf/init",
        "cluster_id": "cluster-1",
			     "system_id": "system-1"

      }
    owner: root:root
    permissions: '0644'
  - path: /etc/update-motd.d/20-cps-text
    content: |
      #!/bin/sh
      product=`jq ".product" /mnt/install/swarm.json  | tr -d '"'`
      identifier=`jq ".identifier" /mnt/install/swarm.json  | tr -d '"'`

      printf "\n"
      printf " * CPS Microservices - ${product}\n"
      printf " * CPS Docker Engine - ${identifier}\n"
      printf "\n"
    owner: root:root
    permissions: '0755'

Worker Cloud Init Example

#cloud-config
debug: True
output: {all: '| tee -a /var/log/cloud-init-output.log'}

users:
  - name: cps
    sudo: ['ALL=(ALL) NOPASSWD:ALL']
    groups: docker
    ssh-authorized-keys:
      - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDzjJjndIvUi
Bta4VSIbd2gJmlMWcQ8wtejgAbiXtoFZdtMdo9G0ZDEOtxHNNDPwWujMi
YAkZhZWX/zON9raavU8lgD9+YcRopWUtujIC71YjtoxIjWIBBbrtqtPlU
XMUXQsi91RQbUtslENP+tSatS3awoQupyBMMSutyBady/7Wq0UTwFsnYs
5Jfs8jIQuMfVQ9uJ4mNn7wJ0N+Iaf27rE0t3oiY5DRN6j07WhauM6lCnZ
1JDlzqmTnTHQkgJ3uKmQa5x73tJ1OW89Whf+R+dfslVn/yUwK/vf4extHT
n32Dtsxkjz7kQeEDgCe/y7owimaEFcCIfEWEaj/50jegN 
cps@root-public-key
chpasswd:
  list: |
    cps:cisco123
  expire: False
write_files:
  - path: /root/swarm.json
    content: |
      {
        "role": "pcrf",
        "identifier": "pcrf-0",
        "master": "172.16.2.11",
        "network": "172.16.2.0/24",
        "registry": "172.16.2.11:5000",
        "consul": "172.16.2.11:8500",
        "reinitialize_data": "1",
        "zing": "1"
      }
    owner: root:root
    permissions: '0644'
  - path: /etc/update-motd.d/20-cps-text
    content: |
      #!/bin/sh
      product=`jq ".product" /root/swarm.json  | tr -d '"'`
      identifier=`jq ".identifier" /root/swarm.json  | tr -d '"'`

      printf "\n"
      printf " * CPS Microservices - ${product}\n"
      printf " * CPS Docker Engine - ${identifier}\n"
      printf "\n"
    owner: root:root
    permissions: '0755'