Advertisement
Guest User

Untitled

a guest
Dec 12th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. # cat ./roles/provision-my-test-apb/tasks/main.yml
  2. ##############################################################################
  3. ## Provision my-test
  4. ## This role executes much of the needed functionality to provision an
  5. ## application using an Ansible Playbook Bundle. Included in the comments
  6. ## below are some sample resources for getting started deploying an application
  7. ## to OpenShift.
  8. ##############################################################################
  9.  
  10.  
  11. ##############################################################################
  12. ## An OpenShift Origin deployment configuration provides a replication
  13. ## controller, spins up pods, and also provides the ability to transition from
  14. ## one deployment of an image to a new one.
  15. ## https://docs.openshift.org/latest/architecture/core_concepts/deployments.html#deployments-and-deployment-configurations
  16. ##############################################################################
  17. - name: create deployment config
  18. openshift_v1_deployment_config:
  19. name: my-test
  20. namespace: '{{ namespace }}'
  21. labels:
  22. app: my-test
  23. service: my-test
  24. replicas: 1
  25. selector:
  26. app: my-test
  27. service: my-test
  28. spec_template_metadata_labels:
  29. app: my-test
  30. service: my-test
  31. containers:
  32. - env:
  33. image: docker.io/ansibleplaybookbundle/hello-world:latest # replace with your application image
  34. name: my-test
  35. ports:
  36. - container_port: 8080
  37. protocol: TCP
  38.  
  39.  
  40. ##############################################################################
  41. ## A Kubernetes service serves as an internal load balancer. It identifies a
  42. ## set of replicated pods in order to proxy the connections it receives to them.
  43. ## https://docs.openshift.org/latest/architecture/core_concepts/pods_and_services.html#services
  44. ##############################################################################
  45. - name: create my-test service
  46. k8s_v1_service:
  47. name: my-test
  48. namespace: '{{ namespace }}'
  49. labels:
  50. app: my-test
  51. service: my-test
  52. selector:
  53. app: my-test
  54. service: my-test
  55. ports:
  56. - name: web
  57. port: 80
  58. target_port: 8080
  59.  
  60.  
  61. ##############################################################################
  62. ## An OpenShift Origin route exposes a service at a host name, so that external
  63. ## clients can reach it by name. Each route consists of a name, a service
  64. ## selector, and an optional security configuration.
  65. ## https://docs.openshift.org/latest/architecture/core_concepts/routes.html
  66. ##############################################################################
  67. - name: create my-test route
  68. openshift_v1_route:
  69. name: my-test
  70. namespace: '{{ namespace }}'
  71. labels:
  72. app: my-test
  73. service: my-test
  74. to_name: my-test
  75. spec_port_target_port: web
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement