Browse Source

Issue #768: AWX Pod going to CrashLoopBackoff state

Signed-off-by: Lakshmi-Patneedi <Lakshmi_Patneedi@Dellteam.com>
Lakshmi-Patneedi 3 years ago
parent
commit
a7b005576b

+ 13 - 7
control_plane/roles/webui_awx/tasks/install_awx.yml

@@ -26,23 +26,29 @@
     state: directory
     mode: "{{ file_perm }}"
 
+- name: Check for awx-operator status
+  stat:
+    path: "{{ awx_manager_file }}"
+  register: awx_operator_repo
+
 - name: Cloning awx-operator from github
   git:
     repo: "{{ awx_operator_link }}"
     dest: "{{ awx_operator_folder }}"
     version: "{{ awx_tag }}"
+  when: not awx_operator_repo.stat.exists
 
 - name: Modifying livenessprobe value
   replace:
     path: "{{ awx_manager_file }}"
-    regexp: 'initialDelaySeconds: 15'
-    replace: 'initialDelaySeconds: 600'
+    regexp: "{{ liveness_probe_initial }}"
+    replace: "{{ liveness_probe_final }}"
 
 - name: Modifying readinessprobe value
   replace:
     path: "{{ awx_manager_file }}"
-    regexp: 'initialDelaySeconds: 5'
-    replace: 'initialDelaySeconds: 300'
+    regexp: "{{ readiness_probe_initial }}"
+    replace: "{{ readiness_probe_final }}"
 
 - name: Create namespace
   command: "kubectl create namespace {{ awx_namespace }}"
@@ -98,7 +104,7 @@
   retries: "{{ min_retries }}"
 
 - name: Waiting for awx-operator deployment to be up and running
-  command: kubectl wait --for=condition=available deployment awx-operator-controller-manager -n {{ awx_namespace }} --timeout=900s
+  command: kubectl wait --for=condition=available deployment awx-operator-controller-manager -n {{ awx_namespace }} --timeout={{ awx_operator_time }}
   changed_when: false
 
 - name: Deploy awx
@@ -124,10 +130,10 @@
 - name: Fails if the pods go into ImagePullBackOff state
   block:
     - name: Waiting for awx deployment to be up and running
-      command: kubectl wait --for=condition=available deployment awx -n {{ awx_namespace }} --timeout=1500s
+      command: kubectl wait --for=condition=available deployment awx -n {{ awx_namespace }} --timeout={{ awx_deployment_time }}
       changed_when: false
 
   rescue:
     - name: Display failure message
       debug:
-        msg: "{{ deployment_failure_msg }}"
+        msg: "{{ deployment_failure_msg }}"

+ 6 - 0
control_plane/roles/webui_awx/vars/main.yml

@@ -30,6 +30,12 @@ awx_wait_time: 90
 deployment_failure_msg: "Deployment failed due to docker pull rate limit"
 awx_operator_link: "https://github.com/ansible/awx-operator.git"
 awx_manager_file: '/root/awx-operator/config/manager/manager.yaml'
+liveness_probe_initial: "initialDelaySeconds: 15"
+liveness_probe_final: "initialDelaySeconds: 600"
+readiness_probe_initial: "initialDelaySeconds: 5"
+readiness_probe_final: "initialDelaySeconds: 300"
+awx_operator_time: 900s
+awx_deployment_time: 1500s
 
 # Usage: configure_settings.yml
 awx_port: 8052