Browse Source

Merge pull request #865 from Lakshmi-Patneedi/devel

Existing hosts inside awx inventory are not visible
Sujit Jadhav 3 năm trước cách đây
mục cha
commit
6fe927dfbf

BIN
control_plane/roles/webui_awx/files/omnia.png


+ 4 - 0
control_plane/roles/webui_awx/tasks/check_prerequisites.yml

@@ -55,6 +55,7 @@
 - block:
 - block:
     - name: Get awx-service cluster-ip
     - name: Get awx-service cluster-ip
       command: "kubectl get svc {{ awx_service_name }} -n {{ awx_namespace }} -o jsonpath='{.spec.clusterIP}'"
       command: "kubectl get svc {{ awx_service_name }} -n {{ awx_namespace }} -o jsonpath='{.spec.clusterIP}'"
+      changed_when: false
       register: awx_cluster_ip
       register: awx_cluster_ip
 
 
     - name: Get AWX admin password
     - name: Get AWX admin password
@@ -62,6 +63,7 @@
         set -o pipefail && \
         set -o pipefail && \
         kubectl get secret awx-admin-password -n {{ awx_namespace }} -o jsonpath='{.data.password}' | base64 --decode
         kubectl get secret awx-admin-password -n {{ awx_namespace }} -o jsonpath='{.data.password}' | base64 --decode
       no_log: true
       no_log: true
+      changed_when: false
       register: awx_admin_password
       register: awx_admin_password
 
 
     - name: Waiting for the AWX UI to be up
     - name: Waiting for the AWX UI to be up
@@ -93,10 +95,12 @@
     - block:
     - block:
          - name: Fetching Schedule from AWX UI
          - name: Fetching Schedule from AWX UI
            command: awx schedules list --all --conf.host http://{{ awx_cluster_ip.stdout }}:{{ awx_port }} --conf.username admin --conf.password {{ awx_admin_password.stdout }} -f human --filter "name"
            command: awx schedules list --all --conf.host http://{{ awx_cluster_ip.stdout }}:{{ awx_port }} --conf.username admin --conf.password {{ awx_admin_password.stdout }} -f human --filter "name"
+           changed_when: false
            register: awx_schedule_list
            register: awx_schedule_list
 
 
          - name: Fetching job_templates from AWX UI
          - name: Fetching job_templates from AWX UI
            command: awx job_templates list --all --conf.host http://{{ awx_cluster_ip.stdout }}:{{ awx_port }} --conf.username admin --conf.password {{ awx_admin_password.stdout }} -f human --filter "name"
            command: awx job_templates list --all --conf.host http://{{ awx_cluster_ip.stdout }}:{{ awx_port }} --conf.username admin --conf.password {{ awx_admin_password.stdout }} -f human --filter "name"
+           changed_when: false
            register: awx_job_templates_list
            register: awx_job_templates_list
 
 
          - name: Updating awx_configuration_status
          - name: Updating awx_configuration_status

+ 3 - 1
control_plane/roles/webui_awx/tasks/configure_settings.yml

@@ -1,4 +1,4 @@
-# Copyright 2021 Dell Inc. or its subsidiaries. All Rights Reserved.
+# Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
 #
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # you may not use this file except in compliance with the License.
@@ -117,6 +117,8 @@
 
 
 - name: Waiting for AWX UI
 - name: Waiting for AWX UI
   wait_for:
   wait_for:
+    host: "{{ awx_cluster_ip.stdout }}"
+    port: "{{ awx_port }}"
     timeout: "{{ awx_ui_wait_time }}"
     timeout: "{{ awx_ui_wait_time }}"
 
 
 - name: Waiting for the AWX UI to be up
 - name: Waiting for the AWX UI to be up

+ 79 - 40
control_plane/roles/webui_awx/tasks/install_awx.yml

@@ -20,36 +20,6 @@
   changed_when: false
   changed_when: false
   register: namespaces
   register: namespaces
 
 
-- name: Creating directory for deploying awx-operator
-  file:
-    path: "{{ awx_operator_folder }}"
-    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: "{{ liveness_probe_initial }}"
-    replace: "{{ liveness_probe_final }}"
-
-- name: Modifying readinessprobe value
-  replace:
-    path: "{{ awx_manager_file }}"
-    regexp: "{{ readiness_probe_initial }}"
-    replace: "{{ readiness_probe_final }}"
-
 - name: Create namespace
 - name: Create namespace
   command: "kubectl create namespace {{ awx_namespace }}"
   command: "kubectl create namespace {{ awx_namespace }}"
   changed_when: true
   changed_when: true
@@ -64,17 +34,86 @@
     name: jq
     name: jq
     state: present
     state: present
 
 
-- name: Deploying awx-operator
-  command: make deploy
-  changed_when: false
-  args:
-    chdir: "{{ awx_operator_folder }}"
-  environment:
-    NAMESPACE: "{{ awx_namespace }}"
+- name: Creating and deploying AWX operator
+  block:
+    - name: Creating directory for deploying awx-operator
+      file:
+        path: "{{ awx_operator_folder }}"
+        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_operator_version }}"
+      when: not awx_operator_repo.stat.exists
+
+    - name: Modifying livenessprobe value
+      replace:
+        path: "{{ awx_manager_file }}"
+        regexp: "{{ liveness_probe_initial }}"
+        replace: "{{ liveness_probe_final }}"
+
+    - name: Modifying readinessprobe value
+      replace:
+        path: "{{ awx_manager_file }}"
+        regexp: "{{ readiness_probe_initial }}"
+        replace: "{{ readiness_probe_final }}"
+
+    - name: Deploying awx-operator
+      command: make deploy
+      changed_when: false
+      args:
+        chdir: "{{ awx_operator_folder }}"
+      environment:
+        NAMESPACE: "{{ awx_namespace }}"
+  rescue:
+    - name: Cleaning awx-operator folder
+      file:
+        path: "{{ awx_operator_folder }}"
+        state: absent
+    
+    - name: Creating directory for deploying awx-operator
+      file:
+        path: "{{ awx_operator_folder }}"
+        state: directory
+        mode: "{{ file_perm }}"
+
+    - name: Cloning awx-operator from github
+      git:
+        repo: "{{ awx_operator_link }}"
+        dest: "{{ awx_operator_folder }}"
+        version: "{{ awx_operator_version }}"
+
+    - name: Modifying livenessprobe value
+      replace:
+        path: "{{ awx_manager_file }}"
+        regexp: "{{ liveness_probe_initial }}"
+        replace: "{{ liveness_probe_final }}"
+
+    - name: Modifying readinessprobe value
+      replace:
+        path: "{{ awx_manager_file }}"
+        regexp: "{{ readiness_probe_initial }}"
+        replace: "{{ readiness_probe_final }}"
+
+    - name: Deploying awx-operator
+      command: make deploy
+      changed_when: false
+      args:
+        chdir: "{{ awx_operator_folder }}"
+      environment:
+        NAMESPACE: "{{ awx_namespace }}"
 
 
-- name: Waiting for awx operator deployment {This might take 10-15 minutes}
+- name: Waiting for awx operator deployment
   block:
   block:
-    - name: Waiting for awx-operator deployment to be up and running
+    - name: Waiting for awx-operator deployment to be up and running (This might take 10-15 minutes)
       command: kubectl wait --for=condition=available deployment awx-operator-controller-manager -n {{ awx_namespace }} --timeout={{ awx_operator_time }}
       command: kubectl wait --for=condition=available deployment awx-operator-controller-manager -n {{ awx_namespace }} --timeout={{ awx_operator_time }}
       changed_when: false 
       changed_when: false 
   rescue:
   rescue:
@@ -125,7 +164,7 @@
   changed_when: true
   changed_when: true
   when: not k8s_pods.stdout | regex_search('awx-([A-Za-z0-9]{10})-([A-Za-z0-9]{5})')
   when: not k8s_pods.stdout | regex_search('awx-([A-Za-z0-9]{10})-([A-Za-z0-9]{5})')
 
 
-- name: Wait for awx pods to get created
+- name: Wait for awx pods to get created (This will take 10min)
   wait_for:
   wait_for:
     timeout: "{{ awx_wait_time }}"
     timeout: "{{ awx_wait_time }}"
   when: not k8s_pods.stdout | regex_search('awx-([A-Za-z0-9]{10})-([A-Za-z0-9]{5})')
   when: not k8s_pods.stdout | regex_search('awx-([A-Za-z0-9]{10})-([A-Za-z0-9]{5})')

+ 5 - 5
control_plane/roles/webui_awx/vars/main.yml

@@ -24,9 +24,9 @@ awx_yml_file_path: "{{ role_path }}/files/awx.yml"
 postgres_storage_class: nfs-client
 postgres_storage_class: nfs-client
 projects_existing_claim: awx-pv-claim
 projects_existing_claim: awx-pv-claim
 awx_version: 19.4.0
 awx_version: 19.4.0
-awx_tag: 0.14.0
+awx_operator_version: 0.17.0
 file_perm: '0644'
 file_perm: '0644'
-awx_wait_time: 90
+awx_wait_time: 600
 deployment_failure_msg: "Deployment failed due to docker pull rate limit"
 deployment_failure_msg: "Deployment failed due to docker pull rate limit"
 awx_operator_link: "https://github.com/ansible/awx-operator.git"
 awx_operator_link: "https://github.com/ansible/awx-operator.git"
 awx_manager_file: '/root/awx-operator/config/manager/manager.yaml'
 awx_manager_file: '/root/awx-operator/config/manager/manager.yaml'
@@ -53,9 +53,9 @@ awx_tcp_ports:
   - 30000-32767
   - 30000-32767
 awx_ui_msg: "AWX Upgrading"
 awx_ui_msg: "AWX Upgrading"
 return_status: 200
 return_status: 200
-max_retries: 20
+max_retries: 25
 max_delay: 15
 max_delay: 15
-awx_ui_wait_time: 200
+awx_ui_wait_time: 900
 
 
 # Usage: check_prerequisites.yml
 # Usage: check_prerequisites.yml
 min_retries: 2
 min_retries: 2
@@ -102,4 +102,4 @@ omnia_job_template_details:
   - { name: deploy_omnia_template, inventory: node_inventory, playbook: omnia.yml, credential: node_credential }
   - { name: deploy_omnia_template, inventory: node_inventory, playbook: omnia.yml, credential: node_credential }
 scheduled_templates:
 scheduled_templates:
   - { name: NodeInventorySchedule, template: node_inventory_job, schedule_rule: "DTSTART:20210815T120000Z RRULE:FREQ=MINUTELY;INTERVAL=10", flag: true }
   - { name: NodeInventorySchedule, template: node_inventory_job, schedule_rule: "DTSTART:20210815T120000Z RRULE:FREQ=MINUTELY;INTERVAL=10", flag: true }
-  - { name: DeviceInventorySchedule, template: device_inventory_job, schedule_rule: "DTSTART:20210815T060000Z RRULE:FREQ=DAILY;INTERVAL=1", flag: "{{ device_support_status }}"}
+  - { name: DeviceInventorySchedule, template: device_inventory_job, schedule_rule: "DTSTART:20210815T060000Z RRULE:FREQ=DAILY;INTERVAL=1", flag: "{{ device_support_status }}"}