Browse Source

Test MCS endpoint on bootstrap to fail early if its unavailable and collect logs

Vadim Rutkovsky 6 years ago
parent
commit
c0ede0d3d1
1 changed files with 21 additions and 0 deletions
  1. 21 0
      playbooks/deploy_cluster_40.yml

+ 21 - 0
playbooks/deploy_cluster_40.yml

@@ -38,6 +38,27 @@
     vars:
       excluded_services:
       - progress.service
+  - name: Wait for MCS endpoint to show up
+    uri:
+      url: "{{ mcd_endpoint }}/config/master"
+      validate_certs: false
+    delay: 10
+    retries: 60
+    register: mcs
+    until:
+    - "'status' in mcs"
+    - mcs.status == 200
+    ignore_errors: true
+  - when: mcs is failed
+    block:
+    - name: Get node logs
+      command: journalctl --no-pager -u bootkube
+      register: bootkube_logs
+      ignore_errors: true
+    - debug:
+        msg: "{{ bootkube_logs.stdout_lines }}"
+    - fail:
+        msg: MCS start failed.
 
 - name: Start masters
   hosts: masters