Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # cat ./roles/provision-my-test-apb/tasks/main.yml
- ##############################################################################
- ## Provision my-test
- ## This role executes much of the needed functionality to provision an
- ## application using an Ansible Playbook Bundle. Included in the comments
- ## below are some sample resources for getting started deploying an application
- ## to OpenShift.
- ##############################################################################
- ##############################################################################
- ## An OpenShift Origin deployment configuration provides a replication
- ## controller, spins up pods, and also provides the ability to transition from
- ## one deployment of an image to a new one.
- ## https://docs.openshift.org/latest/architecture/core_concepts/deployments.html#deployments-and-deployment-configurations
- ##############################################################################
- - name: create deployment config
- openshift_v1_deployment_config:
- name: my-test
- namespace: '{{ namespace }}'
- labels:
- app: my-test
- service: my-test
- replicas: 1
- selector:
- app: my-test
- service: my-test
- spec_template_metadata_labels:
- app: my-test
- service: my-test
- containers:
- - env:
- image: docker.io/ansibleplaybookbundle/hello-world:latest # replace with your application image
- name: my-test
- ports:
- - container_port: 8080
- protocol: TCP
- ##############################################################################
- ## A Kubernetes service serves as an internal load balancer. It identifies a
- ## set of replicated pods in order to proxy the connections it receives to them.
- ## https://docs.openshift.org/latest/architecture/core_concepts/pods_and_services.html#services
- ##############################################################################
- - name: create my-test service
- k8s_v1_service:
- name: my-test
- namespace: '{{ namespace }}'
- labels:
- app: my-test
- service: my-test
- selector:
- app: my-test
- service: my-test
- ports:
- - name: web
- port: 80
- target_port: 8080
- ##############################################################################
- ## An OpenShift Origin route exposes a service at a host name, so that external
- ## clients can reach it by name. Each route consists of a name, a service
- ## selector, and an optional security configuration.
- ## https://docs.openshift.org/latest/architecture/core_concepts/routes.html
- ##############################################################################
- - name: create my-test route
- openshift_v1_route:
- name: my-test
- namespace: '{{ namespace }}'
- labels:
- app: my-test
- service: my-test
- to_name: my-test
- spec_port_target_port: web
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement