Skip to content

Instantly share code, notes, and snippets.

@vallard
Created September 5, 2017 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vallard/1f18bae6ca3081a2349c6f8f924208af to your computer and use it in GitHub Desktop.
Save vallard/1f18bae6ca3081a2349c6f8f924208af to your computer and use it in GitHub Desktop.
KUBAM POC

POC

Part 1: KUBAM boot server

Get docker image:

docker pull kubam/kubam

Make yaml file

mkdir ~/kubam
cd ~/kubam
touch kubam.yaml

File can look like:

---
masterIP: 172.28.225.135
public_keys:
- "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDeV4/Sy+B8R21pKzODfGn5W/p9MC9/4ejFUJoI3RlobYOWWxbLmnHYbKmRHn8Jgpmm4xqv61uaFpbAZvxFTyKIqLdcYmxaHem35uzCJbgB8BvT+4aGg1pZREunX6YaE8+s3hFZRu4ti7UHQYWRD1tCizYz78YHL8snp+N3UAPmP9eTTNw62PHAJERi1Hbl6sRfYijqNlluO223Thqbmhtt3S8tnjkRsFnNxsDgxrfbR3GBQ5925hPth3lGejln2P1L9EIQw9NOmtMhF9UpXPWP9r234p3crmBTsw+E6IF0+OsGKOl8Ri4Im7GpnAgbY9I5THEDn142uNOm6vJATZZ3 root@devi-builder"
nodes:
- name: node01
  ip: 172.28.225.131
  os: esxi6.0
- name: node02
  ip: 172.28.225.132
  os: esxi6.0
- name: node03
  ip: 172.28.225.133
  os: esxi6.0
network:
  netmask: 255.255.254.0
  gateway: 172.28.224.1
  nameserver: 171.70.168.183

Note: Later we will create custom kickstart file in this directory, but for now we will use the default.

Start Container

cd ~/kubam
docker run -p 80:80 -d -v `pwd`:/kubam \
    --device /dev/fuse \
    --cap-add SYS_ADMIN \
    --name kubam \
    kubam/kubam
  • Ensure Web service is running: Open browser to /kubam to see the contents of the kubam directory
  • open browser to or curl localhost to get:
{
  "status": "ok"
}
  • Ensure you can see the VMware ISO image in this directory:
curl http://localhost/api/v1/isos
{
  "isos": [
    "CentOS-7-x86_64-Minimal-1611.iso",
    "Vmware-ESXi-6.0.0-5050593-Custom-Cisco-6.0.3.2.iso"
  ]
}

Extract ISO and build boot images

curl -H "Content-Type: application/json" \
 -X POST \
 -d '{"iso" : "Vmware-ESXi-6.0.0-5050593-Custom-Cisco-6.0.3.2.iso", "os": "esxi6.0" }' \
http://localhost/api/v1/isos/extract

This will create the directory ~/kubam/esxi6.0 which is used for the OS boot images.

Next, build the boot images for the config file.

curl -H "Content-Type: application/json" \
-X POST \
http://localhost/api/v1/servers/images

This will create the SP named image ISO files.

The Install server is now ready for the servers.

Part 2: Ansible

Prework & Issues

  • Make sure there is a pool of management IP addresses
  • Create a pool and put the servers in it. This should be referenced from the service profile template

Get docker image

docker pull kubam/ansible-poc

Start the container

mkdir ~/poc
docker run -v ~/poc:/root/poc -it --rm kubam/ansible-poc /bin/bash

This will put you on the bash prompt of the container. From here, we will copy our Ansible directory to the poc directory so we have all the playbooks.

cp -a /ucsm-ansible/* /root/poc/

Ansible Customizations

Edit the following files:

~/poc/roles/server/tasks/main.yml

This needs to have the KUBAM server IP address in it.

~/inventory/devi

This file should have the UCS Manager. You should get rid of the ansible_interpreter line if there is any.

~/group_vars/kubam

This should be changed to match what you want it to be.

Run Ansible

ansible-playbook kubam.yml

Will run everything.

ansible-playbook kubam_destroy.yml

will destroy everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment