Created
May 29, 2019 21:04
-
-
Save bazzilio/d8447d69708a6217d03984fdd12013d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Полная версия файла - https://github.com/hortonworks/ansible-hortonworks/blob/master/playbooks/group_vars/all | |
blueprint_dynamic: # properties for the dynamic blueprint - these are only used by the 'blueprint_dynamic.j2' template to generate the JSON | |
- host_group: "hdp-master" | |
clients: ['ZOOKEEPER_CLIENT', 'HDFS_CLIENT', 'YARN_CLIENT', 'MAPREDUCE2_CLIENT', 'TEZ_CLIENT', 'PIG', 'SQOOP', 'HIVE_CLIENT', 'OOZIE_CLIENT', 'INFRA_SOLR_CLIENT', 'SPARK2_CLIENT'] | |
services: | |
- ZOOKEEPER_SERVER | |
- AMBARI_SERVER | |
- host_group: "hdp-slave" | |
clients: ['ZOOKEEPER_CLIENT', 'HDFS_CLIENT', 'YARN_CLIENT', 'MAPREDUCE2_CLIENT', 'TEZ_CLIENT', 'PIG', 'SQOOP', 'HIVE_CLIENT', 'OOZIE_CLIENT', 'INFRA_SOLR_CLIENT', 'SPARK2_CLIENT'] | |
services: | |
- DATANODE | |
- NODEMANAGER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Полная версия файла - https://github.com/hortonworks/ansible-hortonworks/blob/master/playbooks/group_vars/example-hdp-ha-3-masters | |
blueprint_dynamic: # properties for the dynamic blueprint - these are only used by the 'blueprint_dynamic.j2' template to generate the JSON | |
- host_group: "hdp-masternode" | |
clients: ['ZOOKEEPER_CLIENT', 'HDFS_CLIENT', 'YARN_CLIENT', 'MAPREDUCE2_CLIENT', 'TEZ_CLIENT', 'SLIDER', 'PIG', 'SQOOP', 'HIVE_CLIENT', 'HCAT', 'OOZIE_CLIENT', 'INFRA_SOLR_CLIENT', 'SPARK2_CLIENT', 'HBASE_CLIENT'] | |
services: | |
- ZOOKEEPER_SERVER | |
- AMBARI_SERVER | |
- host_group: "hdp-worker" | |
clients: ['ZOOKEEPER_CLIENT', 'HDFS_CLIENT', 'YARN_CLIENT', 'MAPREDUCE2_CLIENT', 'TEZ_CLIENT', 'SLIDER', 'PIG', 'SQOOP', 'HIVE_CLIENT', 'HCAT', 'OOZIE_CLIENT', 'INFRA_SOLR_CLIENT', 'SPARK2_CLIENT', 'HBASE_CLIENT'] | |
services: | |
- DATANODE | |
- NODEMANAGER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
children: | |
dp_hadoop: | |
children: | |
dp_datanodes: | |
hosts: | |
hdp-worker: | |
ansible_user: ansible | |
ansible_host: ip2 | |
hdp-masternode: | |
hosts: | |
dp-namenode: | |
ansible_user: ansible | |
ansible_host: ip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Полная версия файла https://github.com/hortonworks/ansible-hortonworks/blob/master/playbooks/set_variables.yml | |
--- | |
- name: Create the required Ansible groups | |
hosts: localhost | |
connection: local | |
gather_facts: False | |
tasks: | |
- name: Initialize the ambari_groups list | |
set_fact: | |
ambari_groups: [] | |
- block: | |
- name: Populate the ambari_groups list (dynamic blueprint) | |
set_fact: | |
ambari_groups: "{{ ambari_groups }} + [ '{{ item.host_group }}' ]" | |
when: groups[item.host_group] is defined and groups[item.host_group]|length > 0 and 'AMBARI_SERVER' in item.services | |
with_items: "{{ blueprint_dynamic }}" | |
no_log: True | |
when: blueprint_file == 'blueprint_dynamic.j2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Описание: | |
- playbooks_set_variables.yml - проблемный плейбук. | |
По задумке авторов исполняется на localhost, берёт переменную blueprint_dynamic и на его основе вхождения AMBARI_SERVER | |
составляет список хостов на исполнение | |
- group_vars_all - дефолтные значения хостов | |
- group_vars_dp_hadoop - целевые значения для моего кластера. Отличается именами host_group. | |
я подставляю те значения, что у меня прописаны в inventory.yml | |
Проблема: | |
Т.к. localhost не входит в группу dp_hadoop, то берёт значения из group_vars/all | |
Вопрос: | |
1. Как прокинуть одинаковые значения blueprint_dynamic и в хосты группы dp_hadoop и на хост, | |
где исполняется плейбук playbooks/set_variables.yml | |
2. На каком хосте лучше исполнять эту таску ? Можно ли тут указать первый хост группы ? | |
Можно ли в hosts прописать groups[dp_hadoop[0]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment