- name: Delete project
  openshift_v1_project:
    name: hello 
    state: absent
    debug: yes
  register: delete_project 

- debug: var=delete_project

- name: Create project
  openshift_v1_project:
    name: hello 
    state: present
    display_name: Hello World 
    description: Hello.
    debug: yes
  register: create_project

- debug: var=create_project

- name: Create service 
  k8s_v1_service:
    name: hello-service 
    namespace: hello 
    state: present
    ports:
      - port: 8080 
        target_port: 8080
        name: web-tcp 
    selector:
      app: hello
    labels:
      app: hello 
    debug: yes
  register: create_service 

- debug: var=create_service

- name: Create deployment config
  openshift_v1_deployment_config:
    name: hello-deploy
    namespace: hello
    state: present 
    debug: yes
    labels:
      app: hello
    spec_template_metadata_name: hello-pod 
    spec_template_metadata_labels:
      app: hello
    containers:
      - name: hello
        image: openshift/busybox-http-app
        ports:
        - container_port: 8080 
          protocol: TCP
          name: web-8080-tcp 
        - container_port: 8100
          protocol: TCP
          name: web-8100-tcp 
    replicas: 1
    selector:
       app: hello
    strategy_type: Rolling
  register: create_deployment

- debug: var=create_deployment
  
- name: Create route
  openshift_v1_route:
    name: hello-route 
    namespace: hello
    state: present
    to_kind: Service
    to_name: hello-service
    to_weight: 100
    port_target_port: web-tcp
    tls_termination: edge
  register: create_route

- debug: var=create_route

