Categories
OpenShift

Getting started with Ansible Playbook Bundles on CDK

Install Ansible Service Broker addon into your CDK installation

Start your CDK environment with registration (important as yum get’s used during addon installation)

export MINISHIFT_ENABLE_EXPERIMENTAL=y
minishift start --service-catalog

Clone the addon repository and install Ansible Service Broker addon:

git clone https://github.com/minishift/minishift-addons.git
cd minishift-addons/add-ons/
minishift addon install ansible-service-broker
minishift addon apply ansible-service-broker

When logging in to your CDK console you should already see the preinstalled APB’s:

Install the ABP command line on your client machine

Configure your shell to use the minishift Docker daemon

eval $(minishift docker-env)

Fetch the APB command line script and make it available in your PATH

wget https://raw.githubusercontent.com/ansibleplaybookbundle/ansible-playbook-bundle/master/scripts/apb-docker-run.sh && mv apb-docker-run.sh apb && chmod +x apb

Verify that your installation works

apb --help

If everything went well you should see something like this:

Test the connection between ABP CLI and CDK

You will need special permissions to work with the broker on your CDK installation. Therefore we need to execute the following:

oc login -u system:admin
oc adm policy add-cluster-role-to-user cluster-admin developer
oc login -u developer

Now let’s see if we can list the preinstalled APB’s:

apb list

Configure Ansible Service Broker to pull images from local registry

In the default config of our Ansible Service Broker the APB’s are pulled from “https://registry.hub.docker.com/”. We need to change this to our local registry running within CDK.

registry:
  - type: local_openshift
    name: lo
    namespaces:
      - openshift
    white_list:
      - ".*-apb$"

The Ansible Service Broker pod now needs to be restarted in order to pull in the new configuration.

Create your first APB

Firstly we use the CLI to scaffold our new service:

apb init sample-service-apb
cd sample-service-apb

Now we locally build our APB. After the process has completed, the newly build APB docker image should appear in your local docker registry:

apb build

Finally we need to push the Docker image to our Service Broker inside CDK:

apb push

Now you should be able to see your first APB in your CDK’s service catalog.

Reference Information

Ansible Playbook Documentation

Getting started with APB development

Minishift Addon – Ansible Service Broker

Ansible Service Broker Configuration

By Sebastian Faulhaber

Sebastian has spent over 8 years at IBM working as a technical consultant focusing on Business Integration and Business Process Management (BPM).
In 2013 Sebastian joined Red Hat as a Solution Architect; In this role, he used his extensive field experience to support customers with their digital transformation using open source & cloud technology. In 2019 Sebastian took over the leadership for a team of IT architects dealing with middleware, container technology and cloud at Red Hat Germany.

Leave a Reply

Your email address will not be published. Required fields are marked *

close

Subscribe to our newsletter.

Please select all the ways you would like to hear from Open Sourcerers:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our newsletter platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.