---
apiVersion: batch/v1
kind: Job
metadata:
  name: "{{ ansible_operator_meta.name }}"
  namespace: "{{ ansible_operator_meta.namespace }}"
spec:
  ttlSecondsAfterFinished: 3600
  template:
    spec:
      serviceAccountName: awx-playbook-integrity-operator
      containers:
        - name: "{{ ansible_operator_meta.name }}"
          image: "{{ _runner_image }}"
          imagePullPolicy: Always
          env:
            - name: FORCE_UPDATE
              value: "True"
            - name: TOKEN
              value: "{{ tower_config_secret['resources'][0]['data']['token'] | b64decode }}"
            - name: CONTROLLER_HOST
              value: "{{ tower_config_secret['resources'][0]['data']['host'] | b64decode }}"
            - name: CONTROLLER_PROJECT_NAME
              value: "{{ project_name }}"
            - name: CONTROLLER_VERIFY_SSL
              value: "False"
            - name: PLAYBOOKINTEGRITY_NAME
              value: "{{ ansible_operator_meta.name }}"
            - name: PLAYBOOKINTEGRITY_NAMESPACE
              value: "{{ ansible_operator_meta.namespace }}"
      restartPolicy: Never
  backoffLimit: 1
