ОШИБКА! ОШИБКА! hosts_kafka.yml: 5: ожидаемый ключ = значение переменной хоста, получено: local - PullRequest
2 голосов
/ 11 июня 2019

Я использую последний Altoros / Ansible-Fabric-Starter , и когда я запускаю ansible-playbook install-python.yml -i hosts_kafka.yml , он выдаетошибка в терминале, говорящая: ОШИБКА!ОШИБКА!hosts_kafka.yml: 5: Ожидаемый ключ = значение, присвоенное переменной хоста, получено: local Я запускаю его в своей локальной системе.Вот моя кафка.yml

all:
  hosts:
    localhost: # localhost connection parameters, used for storing configuration while transferring it between nodes
      ansible_connection: local
  vars:
    domain: example.com
    additional_channels: # optional, common channels are created by default. Just comment it out, if you don't need additional channels.
      - name: a-b # channel name
        particapants: # Organizations, should be included in channel
        - a
        - b
      - name: a-c
        particapants:
        - a
        - c
      - name: b-c
        particapants:
        - b
        - c
    orderer_type: kafka  # Enable kafka orderer, we'll have 4 brokers and 3 zookeepers.
    orderer_count: 3 # Amount of orderers in network, assumed that it equals to amount of organization, so each org will have an own orderer copy
    kafka_replicas: 2 # Set kafka_replicas parameter
    kafka_replication_factor: 3 # Set kafka_replication_factor parameter (https://hyperledger-fabric.readthedocs.io/en/release-1.2/kafka.html)
  children:
    nodes:
      hosts:
        kafka.example.com: # Describes which containers will run on this node
          node_roles:
            - zookeeper # Apache zookeeper instance
            - kafka_broker # Apache kafka instance
          org: kafka # Organization name
          zookeeper_id: 0 # ID for zookeeper
          kafka_broker_id: 0 # ID for kafka-broker
          ansible_host: 172.16.16.1 # Real ip address or domain name of the machine
          ansible_user: username  # User with sudo access
          ansible_private_key_file: ~/path-to-private-key # Private key to identify ourselves
          ansible_ssh_port: 22 # Specify ssh-port here, if case of it's not defaulted.
        # Same structure for any other nodes
        a.example.com:
          node_roles:
            - root_orderer # This node will be used to generate crypto-config for other orderers
            - orderer # This node will host an orderer-service
            - peer # This node will host peers and api containers for organization
            - root_peer # This node will be used to create channels and instantiate chaincode
            - zookeeper # Hosts zookeeper container for kafka-cluster
            - kafka_broker # Hosts broker container for kafka-cluster
            - explorer
          org: a
          orderer_id: 0 # ID of orderer-service which is running on this host
          zookeeper_id: 1
          kafka_broker_id: 1
          ansible_host: 172.16.16.2
          ansible_user: username
          ansible_private_key_file: ~/path-to-private-key
          ansible_ssh_port: 22
        b.example.com:
          node_roles:
            - orderer
            - peer
            - zookeeper
            - kafka_broker
          org: b
          orderer_id: 1
          zookeeper_id: 2
          kafka_broker_id: 2
          ansible_host: 172.16.16.3
          ansible_user: username
          ansible_private_key_file: ~/path-to-private-key
          ansible_ssh_port: 22
        c.example.com: # This node will host only kafka-broker and peer.
          node_roles:
            - peer
            - orderer
            - kafka_broker
          org: c
          orderer_id: 2
          kafka_broker_id: 3
          ansible_host: 172.16.16.4
          ansible_user: username
          ansible_private_key_file: ~/path-to-private-key
          ansible_ssh_port: 22

1 Ответ

1 голос
/ 11 июня 2019

Привет, я нашел ответ сам после исследования, и обнаружил, что его можно исправить, переустановив ansible 2.5.0 + , и все готово.

...