---
apiVersion: batch/v1
kind: Job
metadata:
  generateName: litmus-mongodb-
  namespace: litmus
spec:
  template:
    metadata:
      name: litmus
      labels:
        app: mongodb-deployment-litmus

    spec:
      serviceAccountName: litmus
      restartPolicy: Never
      containers:
      - name: ansibletest
        image: openebs/ansible-runner:ci
        imagePullPolicy: IfNotPresent

        env:
          - name: ANSIBLE_STDOUT_CALLBACK
            #value: log_plays
            value: default

          - name: PROVIDER_STORAGE_CLASS
            # Supported values: openebs-standard, local-storage
            value: openebs-mongodb

          - name: APP_PVC
            value: openebs-mongo

            # Application label
          - name: APP_LABEL
            value: 'app=mongo'

            # Application namespace
          - name: APP_NAMESPACE
            value: app-mongo-ns 

          - name: DEPLOY_TYPE
            value: statefulset

          # Use 'deprovision' for app-clean up
          - name: ACTION
            value: provision

            # define a variable CAPACITY to accept the size given by user
          - name: CAPACITY
            value: 5Gi

            # Number of mongodb replicas
          - name: APP_REPLICA
            value: 'replicas=1'

        command: ["/bin/bash"]
        args: ["-c", "ansible-playbook ./apps/mongodb/deployers/test.yml -i /etc/ansible/hosts -v; exit 0"]

