Skip to content

djzager/ansible-service-broker

 
 

Repository files navigation

Ansible Service Broker

Build Status Go_Report_Card

Ansible Service Broker is an implementation of the Open Service Broker API that will manage applications defined by Ansible Playbook Bundles.

An Ansible Playbook Bundle (APB) is a new method for defining and distributing container applications in OpenShift consisting of a bundle of Ansible Playbooks built into a container with an Ansible runtime.

Read more about the Ansible Service Broker and Ansible Playbook Bundles in this introduction.

NOTE: this broker will be based on the open-service-broker-sdk project in the future.

Project Related Links

Documentation

Published Images

The ansible-service-broker community publishes images in Docker Hub. Image tags:

  • canary - The newest source build
  • latest - The newest release build
  • <release_number> - The stable release of an image

QuickStart - Running Ansible Service Broker

Running

The following will use oc cluster up to bring up a cluster with Ansible Service Broker installed. The script will run from start to finish in under 2 minutes, giving you an easy way to see the Ansible Service Broker in action.

  1. Ensure that your system is setup to run oc cluster up
  2. Download run_latest_build.sh
    wget https://raw.githubusercontent.com/openshift/ansible-service-broker/master/scripts/run_latest_build.sh
    chmod +x ./run_latest_build.sh
    
  3. Execute run_latest_build.sh, this will take ~90 seconds.
    ./run_latest_build.sh
    
  4. You now have a cluster running with the Service Catalog and Ansible Service Broker ready

Sample Workflow

A basic test to see the capabilities of the Ansible Service Broker:

  1. Provision Mediawiki APB
  2. Provision PostgreSQL APB
  3. Bind Mediawiki to PostgreSQL

Steps to accomplish this are:

  1. Log into OpenShift Web Console
  2. Create a new project 'demo'
  3. Select 'Mediawiki(APB)' to Provision
    • Select the 'demo' project
    • Enter a 'Mediawiki Admin User Password': 's3curepw'
    • Select 'Create'
  4. Go Back to Catalog main page
  5. Select 'PostgreSQL(APB)' to Provision
    • Select the 'demo' project
    • Leave 'PostgreSQL Password' blank, a random password will be generated
    • Chose a 'PostgreSQL Version', either version will work.
    • Select 'Create'
  6. View the 'demo' project
  7. Wait till both APBs have finished deploying and you see pods running for mediawiki and postgres
  8. Right click on the kebab menu for mediawiki
  9. Select 'Create Binding'
  10. Select the Postgres service and complete creating the Binding
  11. Redeploy mediawiki so the pod is able to consume the credentials for the database.
  12. View the route for mediawiki and verify the wiki is up and running.

Developer Focused Information Below

Prerequisites

glide is used for dependency management. Binaries are available on the releases page.

Packages

Our dependencies currently require development headers for btrfs and dev-mapper.

CentOS/RHEL/Fedora (sub dnf for Fedora):

sudo yum install device-mapper-devel btrfs-progs-devel etcd

Setup

sudo /sbin/service etcd restart # start etcd
mkdir -p $GOPATH/src/github.com/openshift
git clone https://github.com/openshift/ansible-service-broker.git $GOPATH/src/github.com/openshift/ansible-service-broker
cd $GOPATH/src/github.com/openshift/ansible-service-broker
make vendor

Config A broker is configured via the config.yaml file. It's recommended to copy over etc/example-config.yaml to etc/ansible-service-broker/config.yaml, and edit as desired.

See the Broker Configuration doc for other example configurations.

Targets

Broker Targets

  • make vendor: Installs or updates the dependencies
  • make build: Builds the binary from source
  • make install: Installs the built binary.
  • make prepare-local-env: will set up the local environemt to test and run the broker against a local deployment of catasb
  • make run: Runs the broker with the default profile, configured via etc/generated_local_development.yaml
    • make run can be run without catasb and prepare-local-env by setting the BROKER_INSECURE="true" variable to true in scripts/my_local_dev_vars
  • make uninstall Deletes the installed binary and config.yaml
    • Notes for install, run, and uninstall:
      • The default install prefix is /usr/local. Use make build && sudo make install to build and install.
      • Alternatively you can alter the installation directory by using PREFIX, e.g if you don't want to install somewhere that requires escalated privileges. make build && PREFIX=~ make install

CI Target

  • make ci: Run the CI workflow that gets executed by travis, locally.
    • Workflow:
      • Provision Mediawiki
      • Provision Postgresql
      • Bind Postgresql and Mediawiki
      • Curl the Mediawiki endpoint to check for success
    • Requires:
      • Cluster
      • Service Catalog
      • Ansible-service-broker either running locally or in the cluster
      • DOCKERHUB_ORG="ansibleplaybookbundle"

Docker Development Build Targets

  • make build-image: Builds a docker container of the current source

Docker Release Build Targets

  • make release Builds a docker container using the latest rpm from Copr
  • make push Push the built image

Misc Targets

  • make clean: Delete binaries built from source
  • make run: Runs the broker with the default profile, configured via etc/generated_local_development.yaml
  • make install: Builds the source and installs in $GOPATH/bin
  • make test: Runs the test suite.
  • make vendor: Updates the dependencies
  • make build: Builds a docker container of the current source
  • make deploy: Deploys the currently build container into your cluster
  • make test: Runs the test suite.

Note

Scripts found in /test can act as manual Service Catalog requests until a larger user scenario can be scripted.

About

Ansible Service Broker

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Go 79.4%
  • Shell 11.4%
  • Python 8.2%
  • Makefile 1.0%