Slide 1

Slide 1 text

The Rick and Morty of Automation: OpenShift and Ansible

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

● Originally created by Michael DeHaan ○ Note: recently released vespene.io some kind of build system ● Configuration management system ● Several important design decisions - advantages/disadvantages ○ No agents ○ Runs over SSH ○ Uses YAML ○ Module based ○ Runs in order ○ Not “compiled” ○ Not centralized ○ Does not store state (typically) ○ AWX/Tower is a separate system WHAT IS ANSIBLE?

Slide 4

Slide 4 text

https://www.slideshare.net/egg9/kubernetes-introduction * Other docs set 2003/4 as start of Google’s Borg

Slide 5

Slide 5 text

KUBERENETES OVERVIEW https://kubernetes.io/docs/concepts/architecture/cloud-controller/

Slide 6

Slide 6 text

https://stratechery.com/2018/ibms-old-playbook/

Slide 7

Slide 7 text

1. Provision resources on which to run OpenShift 2. Deploy OpenShift 3. Build containers with Ansible 4. Use OpenShift with basic modules 5. Use OpenShift Ansible Broker WAYS TO USE OPENSHIFT AND ANSIBLE TOGETHER

Slide 8

Slide 8 text

DIFFERENCES BETWEEN OPENSHIFT AND KUBERNETES Differences Between OpenShift/OKD & Kubernetes

Slide 9

Slide 9 text

Kubernetes OpenShift / OKD / OpenShift Origin Open Source Project Curated Kubernetes Distribution / Product N/A Project - High level Kubeadm, plus many other distros openshift-ansible Root containers yes by default Root containers no by default Service Catalog Container image registry Helm Charts Template Service Broker Ingress, etc Router Deployment DeploymentConfig N/A Image Streams Most Linuxes RedHat OS / CentOS

Slide 10

Slide 10 text

https://medium.com/levvel-consulting/the-differences-between-kubernetes-and-openshift-ae778059a90e

Slide 11

Slide 11 text

DEPLOYMENT CONFIG VS DEPLOYMENT https://stackoverflow.com/questions/49916103/what-is-the-different-between-openshift-deploymentconfig-and-kubernetes-deployme

Slide 12

Slide 12 text

PROVISION AWS RESOURCES WITH ANSIBLE FOR OPENSHIFT © 2018 Interdynamix Systems Slide 12 Provision AWS Resources with Ansible

Slide 13

Slide 13 text

BASIC AWS DIAGRAM Public Subnet Private Subnet Worker 0 Worker 1 Controller 0 Router 0 NAT GW INET GW Apps Wildcard ELB Console ELB Util 0 openshift-ansible NOTE: Note mean to denote best security practices, is simply what was deployed for this demo Worker N AWS Provisioner

Slide 14

Slide 14 text

Demo: Provision AWS Infra with Ansible DEMO

Slide 15

Slide 15 text

● That depends ○ It’s not really purposely built as a provisioning system ○ Ansible does not store state, so state (usually) ends up being resource names ○ How do you know when a resource needs to change? ○ But you can do it, and at least everything is in Ansible, you don’t have to switch to another tool, or integrate them together ● Terraform ○ A better provisioner ○ Terraform destroy - so much fun ○ But how to integrate with Ansible? ■ Ansible terraform provisioner + terraform inventory script SHOULD YOU PROVISION WITH ANSIBLE?

Slide 16

Slide 16 text

{ "Version": "2012-10-17", "Statement": [ { "Action": "ec2:*", "Resource": "*", "Effect": "Allow", "Condition": { "StringEquals": { "ec2:Region": "ca-central-1" } } } ] } AWS PERMISSIONS Could be tightened up considerably, other permissions as well...ELB, Route53, S3

Slide 17

Slide 17 text

S3 USED AS IMAGE REPOSITORY

Slide 18

Slide 18 text

What to use? ● https://github.com/openshift/openshift-ansible-contrib ● https://github.com/openshift/openshift-ansible/tree/master/playbooks/aws ● https://github.com/aws-quickstart/quickstart-redhat-openshift ● https://github.com/openshift/openshift-ansible/tree/master/playbooks/aws ● https://aws-quickstart.s3.amazonaws.com/quickstart-redhat-openshift/doc/re d-hat-openshift-on-the-aws-cloud.pdf PROVISION AWS INFRASTRUCTURE WITH ANSIBLE

Slide 19

Slide 19 text

AWS DIAGRAM https://aws-quickstart.s3.amazonaws.com/quickstart-redhat-openshift/doc/red-hat-openshift-on-the-aws-cloud.pdf

Slide 20

Slide 20 text

instance_tags: "{{ {'Name': item.name, 'krole': item.krole, 'kubernetes.io/cluster/' ~ clusterid: clusterid, 'clusterid': clusterid} }}" YAML: WHAT DOES THIS DO?

Slide 21

Slide 21 text

DEPLOY KUBERNETES Deploy OpenShift/OKD with Ansible

Slide 22

Slide 22 text

“You install OKD by running a series of Ansible playbooks. As you prepare to install your cluster, you create an inventory file that represents your environment and OKD cluster configuration. While familiarity with Ansible might make this process easier, it is not required.” - Docs ● openshift-ansible Github Repo ● Example hosts file from my deployment OPENSHIFT ANSIBLE

Slide 23

Slide 23 text

Deploy with openshift-ansible Deploy Jenkins instance with OpenShift/OKD DEMO

Slide 24

Slide 24 text

● Kubespray - https://github.com/kubernetes-incubator/kubespray ● Write your own :) ● Others? OTHER ANISIBLE BASED K8S DISTROS

Slide 25

Slide 25 text

ANSIBLE CONTAINER ansible-container

Slide 26

Slide 26 text

“Ansible Container is an open source project that aims to enable the automation of the entire container build, deployment and management process. Best of all, it uses the same simple, powerful and agentless Ansible automation language that you’re already using, ensuring you can automate the entire application lifecycle.” - Docs ANSIBLE-CONTAINER

Slide 27

Slide 27 text

STATUS? https://blog.octo.com/en/ansible-container-chronicle-of-a-death-foretold/

Slide 28

Slide 28 text

DEPLOY APPS TO KUBERNETES WITH ANSIBLE Deploy Apps to k8s with Ansible

Slide 29

Slide 29 text

Demo: Using Ansible k8s Module Docs ● https://docs.ansible.com/ansible/2.6/modules/k8s_module.html ● https://docs.ansible.com/ansible/2.5/modules/k8s_scale_module.html ● https://docs.ansible.com/ansible/2.7/modules/k8s_facts_module.html ● https://docs.ansible.com/ansible/2.4/helm_module.html ● https://docs.ansible.com/ansible/2.5/plugins/inventory/k8s.html

Slide 30

Slide 30 text

ANSIBLE SERVICE BROKER Ansible Service Broker

Slide 31

Slide 31 text

WHY A SERVICE BROKER? https://www.slideshare.net/MichaelCalizo/openshift-service-broker-and-catalog-ocpmeetup-july-2018

Slide 32

Slide 32 text

INTEGRATE WITH EXTERNAL RESOURCES https://www.youtube.com/watch?v=hxmuy8TvLd0

Slide 33

Slide 33 text

https://www.slideshare.net/MichaelCalizo/openshift-service-broker-and-catalog-ocpmeetup-july-2018

Slide 34

Slide 34 text

https://www.slideshare.net/MichaelCalizo/openshift-service-broker-and-catalog-ocpmeetup-july-2018

Slide 35

Slide 35 text

https://www.slideshare.net/MichaelCalizo/openshift-service-broker-and-catalog-ocpmeetup-july-2018

Slide 36

Slide 36 text

https://www.slideshare.net/MichaelCalizo/openshift-service-broker-and-catalog-ocpmeetup-july-2018

Slide 37

Slide 37 text

Demo: Custom Webhook APB Demo: Mediawiki + Postgres APB Code: Webhook APB code DEMOS AND CODE

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

Interdynamix Edmonton 620 Manulife Place 10180 – 101 Street NW Edmonton, AB T5J 3S4 780.423.7005 Interdynamix Toronto 140 Yonge St. Suite 200 Toronto, ON M5C 1X6 ● Email [email protected] ● Code: https://github.com/ccollicutt/ansible-and-openshift-demo C © 2018 Interdynamix Systems Slide 39 https://hub.interdynamix.com/insight-report