Advertisement
Guest User

Untitled

a guest
Sep 27th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. - name: Openshift start build
  2. hosts: localhost
  3. vars:
  4. endpoint: "https://127.0.01:8443"
  5. user: hifly
  6. password: hifly
  7. namespace: helloworld
  8. buildconfig: sti-ruby
  9. tasks:
  10. - name: Openshift authentication
  11. uri:
  12. url: '{{endpoint}}/oauth/authorize?{{get_parameters}}'
  13. method: GET
  14. user: '{{user}}'
  15. password: '{{password}}'
  16. validate_certs: false
  17. force_basic_auth: yes
  18. status_code: 200
  19. headers:
  20. Content-Type: "application/x-www-form-urlencoded"
  21. vars:
  22. get_parameters: "response_type=token&client_id=openshift-challenging-client"
  23. register: login
  24.  
  25. - name: Extract Openshift authentication build
  26. set_fact:
  27. token: "{{login.url | regex_replace('.*access_token=', '') | regex_replace('&.*', '')}} "
  28.  
  29. - name: Create Project
  30. uri:
  31. url: '{{endpoint}}/oapi/v1/projects'
  32. method: POST
  33. validate_certs: false
  34. force_basic_auth: yes
  35. status_code: 200
  36. headers:
  37. Authorization: 'Bearer {{token}}'
  38. Accept: application/json
  39. Content-Type: application/json
  40. body_format: json
  41. body:
  42. kind: Project
  43. apiVersion: v1
  44. metadata:
  45. name: '{{namespace}}'
  46. creationTimestamp: null
  47.  
  48. - name: Openshift start build
  49. uri:
  50. url: '{{endpoint}}/oapi/v1/namespaces/{{namespace}}/buildconfigs/{{buildconfig}}/instantiate'
  51. method: POST
  52. validate_certs: false
  53. force_basic_auth: yes
  54. status_code: 201
  55. headers:
  56. Authorization: 'Bearer {{token}}'
  57. Accept: application/json
  58. Content-Type: application/json
  59. body_format: json
  60. body:
  61. kind: BuildRequest
  62. apiVersion: v1
  63. metadata:
  64. name: '{{buildconfig}}'
  65. creationTimestamp: null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement