---
apiVersion: batch/v1
kind: Job
metadata:
  generateName: litmus-wordpress-deployment-
  namespace: litmus
spec:
  template:
    metadata:
      name: litmus
      labels:
        app: wordpress-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

            # Storage class to deploy mysql
            # Supported values: local-storage
          - name: PROVIDER_STORAGE_CLASS
            value: openebs-cstor-disk

            # storage class to deploy wordpress
          - name: STORAGE_CLASS
            value: openebs-nfs

            # Application pvc for mysql deployment
          - name: MYSQL_APP_PVC
            value: openebs-mysql

          - name: MYSQL_PASS
            value: w0rdpres5

            # Application PVC name for wordpress deployment
          - name: WORDPRESS_APP_PVC
            value: openebs-wordpress

            # Application label
          - name: APP_LABEL
            value: app=wordpress

            # Affinity Label for Application
          - name: AFFINITY_LABEL
            value: openebs.io/target-affinity

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

          - name: APP_REPLICA
            value: 'replicas=1'
            
           # Use 'deprovision' for app-clean up
          - name: ACTION
            value: provision

           # Pv capacity for MySql
          - name: MYSQL_PV_CAPACITY
            value: 5Gi

           # PV capacity for wordpress  
          - name: WORDPRESS_PV_CAPACITY
            value: 5Gi

           # PV access mode for Worpress deployment
          - name: PVC_ACCESS_MODE
            value: ReadWriteMany

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