arguments:
  ambari_version:
    description: The version of Ambari to install. Defaults to 2.6.2.0.
    default: 2.6.2.0
    choices:
      - 2.6.2.0  # HDP 2.6 / HDP 2.5 / HDP 2.4
      - 2.4.3.0  # HDP 2.5 / HDP 2.4 / HDP 2.3
  java_distro:
    default: openjdk
    description: The distribution of Java to install. Defaults to openjdk.
    choices:
      - openjdk
      - oracle-java
  hdfs_lib_dir:
    default: /opt
    description: The path to HDFS lib. Defaults to /opt.
    required: False
  swift_url:
    default: https://tarballs.openstack.org/sahara-extra/dist/hadoop-openstack/master/hadoop-openstack-2.7.1.jar
    description: Location of the swift jar file.
    required: False

validators:
  - os_case:
       - ubuntu:
           - script:
               apt_update:
                   inline: apt-get update
  - argument_case:
       argument_name: java_distro
       cases:
           openjdk:
               - os_case:
                   - redhat:
                       - package: java-1.8.0-openjdk-devel
                   - ubuntu:
                       - argument_case:
                            argument_name: ambari_version
                            cases:
                                2.6.2.0:
                                    - package: openjdk-8-jdk
                                2.4.3.0:
                                    - package: openjdk-7-jdk
           oracle-java:
               - script: common/oracle_java
  - argument_case:
       argument_name: ambari_version
       cases:
           2.6.2.0:
               - os_case:
                   - redhat:
                       - package: libtirpc-devel
                   - ubuntu:
                       - package: libtirpc-dev
  - os_case:
      - redhat:
          - script: centos/disable_selinux
          - script: centos/disable_certificate_check
          - script:
              centos/setup_java_home:
                env_vars: [java_distro]
          - package: wget
          - script:
              centos/wget_repo:
                env_vars: [ambari_version]
          - package: redhat-lsb
          - package:
            - mariadb
            - mariadb-libs
            - mariadb-server
            - mysql-connector-java
          - package: ntp
          - package:
            - ambari-metrics-monitor
            - ambari-server
            - ambari-metrics-collector
            - ambari-metrics-hadoop-sink
          - package: nmap-ncat
          - package: fuse-libs
          - package: snappy-devel
          - package: iptables-services
      - ubuntu:
          - script:
              ubuntu/wget_repo:
                env_vars: [ambari_version]
          - script:
              ubuntu/setup_java_home:
                env_vars: [java_distro]
          - package:
              - ambari-metrics-assembly
              - ambari-server
              - ambari-logsearch-portal
              - ambari-logsearch-logfeeder
              - ambari-infra-solr-client
              - ambari-infra-solr
              - netcat
              - iptables
              - iptables-persistent
          - package: fuse
          - package:
              - mysql-client
              - mysql-server
              - libmysql-java
  - script: common/mysql_connector_java_link
  - package: ambari-agent
  - script: common/fix_tls_ambari_agent
  - package:
      - unzip
      - zip
      - curl
      - tar
      - rpcbind
      - rng-tools
  - os_case:
      - redhat:
          - script: centos/disable_ambari
          - script: centos/disable_firewall
          - script:
              common/add_jar:
                env_vars: [hdfs_lib_dir, swift_url]
          - script:
              centos/unlimited_security_artifacts:
                env_vars: [unlimited_security_location]
      - ubuntu:
          - script:
              common/add_jar:
                env_vars: [hdfs_lib_dir, swift_url]
  - os_case:
    - redhat:
      - package:
        - krb5-server
        - krb5-libs
        - krb5-workstation
    - ubuntu:
      - package:
        - krb5-admin-server
        - libpam-krb5
        - krb5-user
        - ldap-utils

