--- - name: set namespace set_fact: _namespace: "amq-streams" - name: Create namespace for {{ _namespace }} k8s: state: present definition: "{{ lookup('template', role_path ~ '/templates/namespace.j2' ) | from_yaml }}" - name: Create OperatorGroup k8s: state: present namespace: "{{ _namespace }}" definition: "{{ lookup('file', role_path ~ '/files/olm-operatorgroup/global.yml' ) | from_yaml }}" - name: Check if csv/{{ _amqstreams_csv_verison }} is already Succeeded (note; error can be ignored) command: > oc get csv/{{ _amqstreams_csv_verison }} -o jsonpath='{.status.phase}' -n "{{ _namespace }}" register: currentstreamscsv ignore_errors: true - name: Create operator k8s: state: present namespace: "{{ _namespace }}" definition: "{{ lookup('file', role_path ~ '/files/amq-streams/operator.yml' ) | from_yaml }}" when: currentstreamscsv.stdout != "Succeeded" - name: Wait until csv/{{ _amqstreams_csv_verison }} is Succeeded command: > oc get csv/{{ _amqstreams_csv_verison }} -o jsonpath='{.status.phase}' -n "{{ _namespace }}" register: streamscsv retries: "{{ _retry }}" delay: "{{ _delay }}" until: streamscsv.stdout == "Succeeded"