- Ensure you have
ansible
and python prereqs installed:pip3 install ansible kubernetes jmespath
- Make sure you have
oc
,rosa
, andaws
CLIs installed. - Run
aws configure
,rosa login
, andoc login
to authenticate to everything.
- Clone this repository, and
cd
into theansible
subdirectory:git clone https://github.com/andykrohg/cs-workshop-scoreboard-client.git cd cs-workshop-scoreboard-client/ansible
- Run the
main.yml
playbook:ansible-playbook main.yml
You can modify the client for use with other workshops by updating the playbooks, or indeed using whatever language or framework you're most comfortable with. Here's how the client works:
-
Run in a loop to continually scoop up updates as participants make their way along. We accomplish by wrapping our playbook execution in a bash script. We also use fact-caching to improve performance and avoid running unnecessary queries against the Kubernetes API.
-
Use RoleBindings to ensure your client has permissions to access the data it needs to collect from your cluster. We create this as part of the template that's used to deploy the client.
-
Send a PUT Request to the scoreboard server at the end of each loop to either register your attendee or update the status. We're using the
uri
ansible module to accomplish this in our playbook, and our payload looks something like this:{ "attendeeName": "Andy Krohg", "workshopTasks": [ { "module": "0", "status": "success" }, { "module": "0", "status": "info" }, { "module": "0", "status": "pending" } ... { "module": "1", "status": "pending" } ] }
Here's how it's constructed:
attendeeName
is set to the value the attendee used for theMY_NAME
environment variable.workshopTasks
is an ordered list of tasks, each carrying the following attributes:module
: the module identifier, which should match with theid
in your server'smodules.json
filestatus
: the completion status, wherepending
is not yet started,info
is in progress, andsuccess
is complete
Once you're satisfied with your changes, proceed below to build a container for the client. You'll also need to create your own server image, instructions for which can be found here.
- Build a container image with podman:
podman build --platform linux/amd64 -t scoreboard-client -f Containerfile .
- Now you're ready to push your new image to quay.io and substitute it in the deployment template here, or through some other means of deployment.