Andrew Block
2020-02-18 2cb03549a8ab72d7ae6962eb1add9f62ead796e8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
# Implement your Workload deployment tasks here
 
- name: Setting up workload for user
  debug:
    msg: "Setting up workload for user ocp_username = {{ ocp_username }}"
 
- name: Install tekton CLI (tkn)
  become: yes
  unarchive:
    src: "{{ _tekton_cli_url }}"
    remote_src: yes
    dest: /usr/local/bin
    mode: 0775
    owner: root
    group: root
 
- name: Install yq CLI
  become: yes
  get_url:
    url: "{{ _yq_cli_url }}"
    dest: /usr/local/bin/yq
    mode: 0775
    owner: root
    group: root
 
- name: Install knative CLI (kn)
  become: yes
  get_url:
    url: "{{ _knative_cli_url }}"
    dest: /usr/local/bin/kn
    mode: 0775
    owner: root
    group: root
 
- name: Install OpenShift Pipelines
  k8s:
    state: present
    definition: "{{ lookup('file', './files/pipelines-subscription.yml') }}"
  tags:
    - pipelines
 
- name: Wait until OpenShift Pipelines Operator CRD is installed
  k8s_info:
    api_version: apiextensions.k8s.io/v1beta1
    kind: CustomResourceDefinition
    name: config.operator.tekton.dev
  ignore_errors: yes
  delay: 10
  register: tekton_operator_crd
  retries: 20
  until: tekton_operator_crd.resources | list | length  == 1
 
- name: Wait until OpenShift Pipelines is installed
  become: yes
  k8s_info:
    api_version: operator.tekton.dev/v1alpha1
    kind: Config
    name: cluster
  ignore_errors: yes
  delay: 10
  register: tekton_cluster_config
  retries: 20
  until: ('resources' in tekton_cluster_config) and (tekton_cluster_config.resources | list | length == 1) and (tekton_cluster_config.resources[0].status.conditions[0].code == "installed")
 
- name: Create RHD Infra Project
  k8s:
    api_version: v1
    kind: Namespace
    name: "{{ _rhd_infra_project }}"
    state: present
 
- name: Create Nexus Repository Server
  shell: "oc -n {{ _rhd_infra_project }} new-app sonatype/nexus -o yaml | oc apply -n {{ _rhd_infra_project }} -f-"
 
# Leave this as the last task in the playbook.
- name: workload tasks complete
  debug:
    msg: "Workload Tasks completed successfully."
  when: not silent|bool