Wolfgang Kulhanek
2018-08-01 4bbf7fcb3d5be8dd408a006a348bb5278e47ea4b
Hopefully fixed nexus role
1 files modified
48 ■■■■ changed files
ansible/roles/install-nexus/tasks/main.yml 48 ●●●● patch | view | raw | blame | history
ansible/roles/install-nexus/tasks/main.yml
@@ -2,29 +2,31 @@
## Sonatype Nexus Install
##
  - name: Copy Nexus template to master
    copy:
      src: files/nexus{{nexus_version}}-persistent-template.yaml
      dest: /root/nexus-template.yaml
- name: Check if Nexus was already provisioned
  command: "oc get service nexus -n {{desired_project}}"
  register: nexus_already_installed
  ignore_errors: true
  changed_when: false
- name: Copy Nexus template to master
  copy:
    src: files/nexus{{nexus_version}}-persistent-template.yaml
    dest: /root/nexus-template.yaml
  when: nexus_already_installed is failed
      
  - name: Check if Nexus was already provisioned
    command: "oc get service nexus -n {{desired_project}}"
    register: install_nexus
    ignore_errors: true
    changed_when: false
### We should add a check if a pv is already created (nexus requests a 10Gi pv)
  - name: Instantiate Nexus from template
    command: "oc new-app -f /root/nexus-template.yaml --param=VOLUME_CAPACITY=10Gi --param=MAX_MEMORY=8Gi -n {{desired_project}}"
    when: install_nexus | failed
- name: Instantiate Nexus from template
  command: "oc new-app -f /root/nexus-template.yaml --param=VOLUME_CAPACITY=10Gi --param=MAX_MEMORY=8Gi -n {{desired_project}}"
  when: nexus_already_installed is failed
  # looks like we need a better check - it seems we're ready up to several
  # seconds before the router finds out about us, so we might want another
  # http check to make sure nexus is responding
  - name: Wait for Nexus to be running
    command: "oc get dc/nexus -o yaml -n {{desired_project}}"
    register: result
    until: '"availableReplicas: 1" in result.stdout'
    retries: 5
    delay: 60
    changed_when: false
# looks like we need a better check - it seems we're ready up to several
# seconds before the router finds out about us, so we might want another
# http check to make sure nexus is responding
- name: Wait for Nexus to be running
  command: "oc get dc/nexus -o yaml -n {{desired_project}}"
  register: result
  until: '"availableReplicas: 1" in result.stdout'
  retries: 5
  delay: 60
  changed_when: false
  when: nexus_already_installed is failed