- name: Create project
  openshift_v1_project:
    name: test-resource-defn
    display_name: Resource Defn 
    description: Load resources 
    debug: no
  register: create_project

- debug: var=create_project

# Create service from unaltered YAML copied from console
- name: Create service from resource definition
  k8s_v1_service:
    state: present
    debug: yes
    resource_definition:
      apiVersion: v1
      kind: Service
      metadata:
        name: hello-service
        namespace: test-resource-defn 
        selfLink: /api/v1/namespaces/hello/services/hello-service
        uid: fd228ddb-0f38-11e7-840c-a2a3304da08d
        resourceVersion: '42303'
        creationTimestamp: '2017-03-22T19:51:49Z'
      labels:
        app: hello
      spec:
        ports:
          - name: web-tcp
            protocol: TCP
            port: 8080
            targetPort: 8080
        selector:
          app: hello
        type: ClusterIP
        sessionAffinity: None
      status:
        loadBalancer: {} 
  register: create_service 

- debug: var=create_service

- name: Create deployment from resource file
  openshift_v1_deployment_config:
    state: present
    debug: yes
    src: "{{ role_path }}/files/deployment.yml"
  register: deployment_create
  
- debug: var=deployment_create
