---

- name: Deploy hdfs resources
  include_tasks: deploy_resources.yml
  vars:
    values_file: /tmp/metering-values.yaml
    resources:
      - template_file: templates/hadoop/hadoop-config.yaml
        apis: [ {kind: secret} ]
        prune_label_value: hadoop-config
        # always create the hadoop-config
        create: true
      - template_file: templates/hadoop/hadoop-aws-credentials.yaml
        apis: [ {kind: secret} ]
        prune_label_value: hadoop-aws-credentials
        create: "{{ meteringconfig_create_hadoop_aws_credentials }}"
      - template_file: templates/hadoop/hadoop-azure-credentials.yaml
        apis: [ {kind: secret} ]
        prune_label_value: hadoop-azure-credentials
        create: "{{ meteringconfig_create_hadoop_azure_credentials }}"
      - template_file: templates/hadoop/hadoop-gcs-credentials.yaml
        apis: [ {kind: secret} ]
        prune_label_value: hadoop-gcs-credentials
        create: "{{ meteringconfig_create_hadoop_gcs_credentials }}"
      - template_file: templates/hadoop/hadoop-s3-compatible-credentials.yaml
        apis: [ {kind: secret} ]
        prune_label_value: hadoop-s3-compatible-credentials
        create: "{{ meteringconfig_create_hadoop_s3_compatible_credentials }}"
      - template_file: templates/hadoop/hadoop-s3-compatible-ca-secret.yaml
        apis: [ {kind: secret} ]
        prune_label_value: hadoop-s3-compatible-ca-secret
        create: "{{ meteringconfig_create_presto_s3_compatible_ca }}"
      - template_file: templates/hadoop/hadoop-scripts.yaml
        apis: [ {kind: configmap} ]
        prune_label_value: hadoop-scripts
        create: "{{ meteringconfig_enable_hdfs }}"
      - template_file: templates/hadoop/hdfs-jmx-config.yaml
        apis: [ {kind: configmap} ]
        prune_label_value: hdfs-jmx-config
        create: "{{ meteringconfig_enable_hdfs }}"
      - template_file: templates/hadoop/hdfs-serviceaccount.yaml
        apis: [ {kind: serviceaccount} ]
        prune_label_value: hdfs-service-account
        create: "{{ meteringconfig_enable_hdfs }}"
      - template_file: templates/hadoop/hdfs-datanode-statefulset.yaml
        apis: [ {kind: statefulset, api_version: 'apps/v1'} ]
        prune_label_value: hdfs-datanode-statefulset
        create: "{{ meteringconfig_enable_hdfs }}"
      - template_file: templates/hadoop/hdfs-namenode-statefulset.yaml
        apis: [ {kind: statefulset, api_version: 'apps/v1'} ]
        prune_label_value: hdfs-namenode-statefulset
        create: "{{ meteringconfig_enable_hdfs }}"
