| | |
| | | - name: Create OpenShift Objects for Nexus Operator |
| | | k8s: |
| | | state: present |
| | | merge_type: |
| | | - strategic-merge |
| | | - merge |
| | | definition: "{{ lookup('template', item ) | from_yaml }}" |
| | | loop: |
| | | - ./templates/project.j2 |
| | |
| | | - ./templates/role_binding.j2 |
| | | - ./templates/operator.j2 |
| | | |
| | | - name: Wait for Nexus operator Pod to be ready |
| | | k8s_facts: |
| | | api_version: v1 |
| | | kind: Deployment |
| | | namespace: "{{ _nexus_operator_project }}" |
| | | name: "nexus-operator" |
| | | register: r_nexus_operator_deployment |
| | | retries: 20 |
| | | delay: 10 |
| | | until: |
| | | - r_nexus_operator_deployment.resources | length | int > 0 |
| | | - r_nexus_operator_deployment.resources[0].status.availableReplicas is defined |
| | | - r_nexus_operator_deployment.resources[0].status.availableReplicas | int == r_nexus_operator_deployment.resources[0].spec.replicas | int |
| | | |
| | | - name: Deploy default Nexus instance |
| | | when: _nexus_deploy_nexus_instance|bool |
| | | when: _nexus_deploy_nexus_instance | bool |
| | | block: |
| | | - name: Create OpenShift Custom Resource for Nexus Instance |
| | | k8s: |
| | | state: present |
| | | merge_type: |
| | | - strategic-merge |
| | | - merge |
| | | definition: "{{ lookup('template', './templates/opentlc-nexus.j2' ) | from_yaml }}" |
| | | - name: Wait for Nexus Pod to start creating |
| | | pause: |
| | | seconds: 20 |
| | | - name: Get pod name for nexus pod |
| | | k8s_facts: |
| | | kind: Pod |
| | | namespace: "{{ _nexus_operator_project }}" |
| | | label_selectors: |
| | | - app={{ _nexus_name }} |
| | | register: nexus_pods |
| | | - name: Get Admin password |
| | | k8s: |
| | | api_version: gpte.opentlc.com/v1alpha1 |
| | | kind: Nexus |
| | | name: "{{ _nexus_name }}" |
| | | namespace: "{{ _nexus_operator_project }}" |
| | | register: nexus_cr |
| | | until: |
| | | - nexus_cr.result.status.conditions[0].type == "Running" |
| | | retries: 50 |
| | | delay: 5 |
| | | changed_when: false |
| | | - name: Get Admin password |
| | | k8s: |
| | | api_version: gpte.opentlc.com/v1alpha1 |
| | | kind: Nexus |
| | | name: "{{ _nexus_name }}" |
| | | namespace: "{{ _nexus_operator_project }}" |
| | | register: nexus_cr |
| | | until: |
| | | - nexus_cr.result.status.admin_password is defined |
| | | retries: 50 |
| | | delay: 5 |
| | | changed_when: false |
| | | - name: Display Nexus password |
| | | debug: |
| | | msg: "user.info: Nexus password is {{ nexus_cr.result.status.admin_password }}" |
| | | - name: Create OpenShift Custom Resource for Nexus Instance |
| | | k8s: |
| | | state: present |
| | | definition: "{{ lookup('template', './templates/opentlc-nexus.j2' ) | from_yaml }}" |
| | | |
| | | - name: Wait for Nexus Pod to be ready |
| | | k8s_facts: |
| | | api_version: v1 |
| | | kind: Deployment |
| | | namespace: "{{ _nexus_operator_project }}" |
| | | name: "{{ _nexus_name }}" |
| | | register: r_nexus_deployment |
| | | retries: 20 |
| | | delay: 10 |
| | | until: |
| | | - r_nexus_deployment.resources | length | int > 0 |
| | | - r_nexus_deployment.resources[0].status.availableReplicas is defined |
| | | - r_nexus_deployment.resources[0].status.availableReplicas | int == r_nexus_deployment.resources[0].spec.replicas | int |
| | | |
| | | - name: Get Nexus admin password |
| | | k8s: |
| | | api_version: gpte.opentlc.com/v1alpha1 |
| | | kind: Nexus |
| | | name: "{{ _nexus_name }}" |
| | | namespace: "{{ _nexus_operator_project }}" |
| | | register: r_nexus |
| | | until: |
| | | - r_nexus.result.status.admin_password is defined |
| | | retries: 20 |
| | | delay: 5 |
| | | |
| | | - name: Display Nexus password |
| | | debug: |
| | | msg: "user.info: Nexus password is {{ r_nexus.result.status.admin_password }}" |
| | | |
| | | # Leave this as the last task in the playbook. |
| | | - name: workload tasks complete |