Getting notified when awx-operator has ended AWX installation

Hello,

I wonder what’s the better way to getting notified when the awx-operator has ended its reconciliation loop (and eventually its state)?

To illustrate my request, here is my use case: I install AWX through the operator, I follow the logs and when the reconciliation loop has successfully ended there is no more log and the play recap state there where no changed tasks, then I can run a job in order to initialize my AWX instance. What I want to achieve is a way to getting notified when I can run my init job automatically.

I do two things:

- name: Wait for {{ awx_instance_name }} pods to be running and that the migration pod has succeeded
  kubernetes.core.k8s_info:
    api_version: v1
    kind: Pod
    namespace: awx
    label_selectors:
      - app.kubernetes.io/part-of = {{ awx_instance_name }}
      - app.kubernetes.io/operator-version = {{ awx_operator_tag }}
  register: _pod_list
  until: _pod_list|json_query('resources[*].status.phase')|unique == ["Succeeded","Running"]
  retries: 20
  delay: 60

- name: Pause play until awx is responding to liveness check
  ansible.builtin.uri:
    url: http://{{ awx_instance_name }}.{{ awx_domain_name }}/api/v2/ping/
    follow_redirects: none
    method: GET
  # This task does not do changes, it should always run, even in check mode
  check_mode: false
  register: _awx_liveness_result
  until: _awx_liveness_result.status == 200
  retries: 60
  delay: 5

Thanks a lot for your answer. I already thought about looking to the liveness check, but the fact is that AWX’s liveness check passes before operator has ended his reconciliation loop.

that’s why I have two tasks :slight_smile:

the first task waits for new pods with new version to be in place and for migration pod to be finished, the 2nd task waits for new awx to respond to liveness check, I’ve updated a few times using these checks – but until a few versions ago the migration was not tagged with part-of and operator-version, that only changed 1/2 operator releases ago.

1 Like

I didn’t noticed this behaviour change. Thanks you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.