hortonworks / ansible-hortonworks

Ansible playbooks for deploying Hortonworks Data Platform and DataFlow using Ambari Blueprints
Apache License 2.0
248 stars 253 forks source link

HDF-only cluster creation fails on undefined hdp variable #130

Open vodwood opened 5 years ago

vodwood commented 5 years ago

Installing an HDF-only cluster with below variables on a static inventory:

cluster_name: 'TNGK2NiFiCluster'
ambari_version: '2.7.3.0'
hdf_version: '3.3.1.0'                                    # must be the 4-part full version number
hdf_build_number: 'auto'  
repo_base_url: 'http://public-repo-1.hortonworks.com'
timezone: UTC
disable_firewall: yes
external_dns: yes
java: 'embedded'
database: 'postgres'
database_options:
  add_repo: yes
  external_hostname: ''
  ambari_db_name: ambari
  ambari_db_username: ambari
  ambari_db_password: "{{ default_password }}"
  rangeradmin_db_name: ranger
  rangeradmin_db_username: ranger
  rangeradmin_db_password: "{{ default_password }}"

security: 'none'
ranger_options:                                           
  enable_plugins: yes

ranger_security_options:                                  # only used if RANGER_ADMIN is part of the blueprint stack
  ranger_admin_password: "{{ default_password }}"         # the password for the Ranger admin users (both admin and amb_ranger_admin)
  ranger_keyadmin_password: "{{ default_password }}"      # the password for the Ranger keyadmin user (will only be set in HDP3, in HDP2 it will remain the default keyadmin)
  kms_master_key_password: "{{ default_password }}"

ambari_admin_password: 'admin'                            # the password for the Ambari admin user
default_password: ''

nifi_security_options:
  encrypt_password: "{{ default_password }}"              # the password used to encrypt raw configuration values
  sensitive_props_key: "{{ default_password }}"

smartsense_security_options:
  admin_password: "{{ default_password }}"                # password for the Activity Explorer's Zeppelin admin user

logsearch_security_options:
  admin_password: "{{ default_password }}"

ambari_admin_user: 'admin'
ambari_admin_default_password: "{{ default_password }}"                    # no need to change this (unless the Ambari default changes)
config_recommendation_strategy: 'ALWAYS_APPLY_DONT_OVERRIDE_CUSTOM_VALUES'

wait: true                                                # wait for the cluster to finish installing
wait_timeout: 3600                                        # 60 minutes
accept_gpl: yes   

cluster_template_file: 'cluster_template.j2'

blueprint_name: '{{ cluster_name }}_blueprint'                  # the name of the blueprint as it will be stored in Ambari
blueprint_file: 'blueprint_dynamic.j2'                          # the blueprint JSON file - 'blueprint_dynamic.j2' is a Jinja2 template that generates the required JSON
blueprint_dynamic:                                              # properties for the dynamic blueprint - these are only used by the 'blueprint_dynamic.j2' template to generate the JSON
  - host_group: "hdf-management"
    clients: ['ZOOKEEPER_CLIENT', 'INFRA_SOLR_CLIENT']
    services:
      - ZOOKEEPER_SERVER
      - AMBARI_SERVER
      - INFRA_SOLR
      - NIFI_REGISTRY_MASTER
      - RANGER_ADMIN
      - RANGER_USERSYNC
      - METRICS_COLLECTOR
      - METRICS_GRAFANA
      - METRICS_MONITOR
  - host_group: "hdf-worker-nozoo"
    clients: ['ZOOKEEPER_CLIENT', 'INFRA_SOLR_CLIENT']
    services:
      - NIFI_MASTER
      - SUPERVISOR
      - METRICS_MONITOR
  - host_group: "hdf-worker-zoo"
    clients: ['ZOOKEEPER_CLIENT', 'INFRA_SOLR_CLIENT']
    services:
      - ZOOKEEPER_SERVER
      - NIFI_MASTER
      - SUPERVISOR
      - METRICS_MONITOR
  - host_group: "hdf-zoo"
    clients: ['ZOOKEEPER_CLIENT', 'INFRA_SOLR_CLIENT']
    services:
      - ZOOKEEPER_SERVER

hdp_minor_version: "{{ hdp_version | regex_replace('.[0-9]+.[0-9]+[0-9_-]*$','') }}"
hdp_major_version: "{{ hdp_minor_version.split('.').0 }}"
hdf_minor_version: "{{ hdf_version | regex_replace('.[0-9]+.[0-9]+[0-9_-]*$','') }}"
hdf_major_version: "{{ hdf_minor_version.split('.').0 }}"
utils_version: "{{ '1.1.0.20' if hdp_minor_version is version_compare('2.5', '<') else ('1.1.0.21' if hdp_version is version_compare('2.6.4', '<') else '1.1.0.22' ) }}"
hdfs_ha_name: "{{ cluster_name | regex_replace('_','-') }}"

is_vm_docker_containers: 'no'

The installation fails on the following task: TASK [Fail if the selected components should not be part of an HDP 3 blueprint] ********************************************************************************************************************************* fatal: [ambari01]: FAILED! => {"msg": "The conditional check 'install_hdp and hdp_major_version == '3' and item in blueprint_all_clients | union(blueprint_all_services)' failed. The error was: error while evaluating conditional (install_hdp and hdp_major_version == '3' and item in blueprint_all_clients | union(blueprint_all_services)): 'hdp_version' is undefined\n\nThe error appears to have been in '/vagrant/playbooks/check_dynamic_blueprint.yml': line 52, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Fail if the selected components should not be part of an HDP 3 blueprint\n ^ here\n"} Setting a boolean value to the variable hdp_version does not resolve the issue.

What might me a suggested way to not install HDP?

alexandruanghel commented 5 years ago

Hi @vodwood fair enough :) I didn't add variable definition checks for everything as I always tested with all of the variables set. But I take the point, will add those checks.