Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - name: Openshift start build
- hosts: localhost
- vars:
- endpoint: "https://127.0.01:8443"
- user: hifly
- password: hifly
- namespace: helloworld
- buildconfig: sti-ruby
- tasks:
- - name: Openshift authentication
- uri:
- url: '{{endpoint}}/oauth/authorize?{{get_parameters}}'
- method: GET
- user: '{{user}}'
- password: '{{password}}'
- validate_certs: false
- force_basic_auth: yes
- status_code: 200
- headers:
- Content-Type: "application/x-www-form-urlencoded"
- vars:
- get_parameters: "response_type=token&client_id=openshift-challenging-client"
- register: login
- - name: Extract Openshift authentication build
- set_fact:
- token: "{{login.url | regex_replace('.*access_token=', '') | regex_replace('&.*', '')}} "
- - name: Create Project
- uri:
- url: '{{endpoint}}/oapi/v1/projects'
- method: POST
- validate_certs: false
- force_basic_auth: yes
- status_code: 200
- headers:
- Authorization: 'Bearer {{token}}'
- Accept: application/json
- Content-Type: application/json
- body_format: json
- body:
- kind: Project
- apiVersion: v1
- metadata:
- name: '{{namespace}}'
- creationTimestamp: null
- - name: Openshift start build
- uri:
- url: '{{endpoint}}/oapi/v1/namespaces/{{namespace}}/buildconfigs/{{buildconfig}}/instantiate'
- method: POST
- validate_certs: false
- force_basic_auth: yes
- status_code: 201
- headers:
- Authorization: 'Bearer {{token}}'
- Accept: application/json
- Content-Type: application/json
- body_format: json
- body:
- kind: BuildRequest
- apiVersion: v1
- metadata:
- name: '{{buildconfig}}'
- creationTimestamp: null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement