Procházet zdrojové kódy

waiting for central to say hello

Grega Bremec před 3 roky
rodič
revize
718eb3068a
1 změnil soubory, kde provedl 18 přidání a 2 odebrání
  1. 18 2
      roles/deploy-central/tasks/main.yml

+ 18 - 2
roles/deploy-central/tasks/main.yml

@@ -53,8 +53,6 @@
     central_is_there: false
   when: (central is not defined) or (central.resources is not defined) or (central.resources | length == 0) or (central.resources[0].status.phase != "Running")
 
-#- name: is there anyone home at the api endpoint?
-
 - name: create ns, og, and sub
   kubernetes.core.k8s:
     kubeconfig: "{{ ansible_facts['user_dir'] }}/kubeconfig-ocp4"
@@ -146,6 +144,23 @@
     dest: "{{ ansible_facts['user_dir'] }}/api-password"
     content: "{{ central_pass | string | b64decode }}"
 
+- name: wait for central to be up
+  uri:
+    method: GET
+    force_basic_auth: true
+    return_content: true
+    validate_certs: false
+    url: "https://{{ central_ep }}/v1/centralhealth/upgradestatus"
+    url_username: admin
+    url_password: "{{ central_pass | string | b64decode }}"
+    headers:
+      Accept: application/json
+      Content-Type: application/json
+  register: central_status
+  until: central_status.status == 200
+  retries: 30
+  delay: 5
+
 - name: does a token exist?
   uri:
     method: GET
@@ -169,6 +184,7 @@
     url: "https://{{ central_ep }}/v1/apitokens/generate"
     url_username: admin
     url_password: "{{ central_pass | string | b64decode }}"
+    body_format: json
     body: '{"name":"automation","role":null,"roles":["Admin"]}'
     headers:
       Accept: application/json