Ansible role that manages hello-world application in Kubernetes | OpenShift.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
build Use latest ansible operator + status subresource Jan 15, 2019
defaults Document where and namespace come from in defaults Nov 29, 2018
deploy Update for operator-sdk changes Jan 30, 2019
tasks Use api_exists instead of apply to avoid confusion Dec 6, 2018
templates Add operator files, fix defaults Nov 28, 2018
.travis.yml Initial commit Nov 26, 2018 README nitpicks Nov 29, 2018
watches.yaml Add operator files, fix defaults Nov 28, 2018

Ansible Role: Hello World Kubernetes

Build Status

Manages a Hello World application in Kubernetes|OpenShift. This project also includes the necessary bits for deploying this role with Ansible Operator in a Kubernetes|OpenShift cluster.


Role Variables

See defaults/main.yml.



Example Playbook

NOTE The example below assumes that you have a running Kubernetes|OpenShift cluster and that you have sufficient permissions in the my-hello-world-namespace namespace.

- hosts: localhost
    name: my-hello-world
    namespace: my-hello-world-namespace
    size: 3
    - djzager.hello_world_k8s

Example Operator

NOTE The example below assumes that you are essentially a cluster admin for the Kubernetes|OpenShift cluster. This is because you'll be creating a Role, Service Accounts Role Binding, and a Custom Resource Definition.

First, we build our operator using operator-sdk, link here:

$ operator-sdk build hello-world-operator

Then, we create the important objects our operator needs to run:

$ kubectl create -f deploy/service_account.yaml \
                 -f deploy/role.yaml \
                 -f deploy/role_binding.yaml \
                 -f deploy/crds/examples_v1alpha1_helloworld_crd.yaml \

Then, we start the operator:

# Use the image name from the operator-sdk build step above
# and set the imagePullPolicy to Never
$ sed 's|REPLACE_IMAGE|hello-world-operator|g; s|Always|Never|' deploy/operator.yaml | kubectl create -f -

Finally, create a HelloWorld resource:

$ kubectl create -f deploy/crds/examples_v1alpha1_helloworld_cr.yaml