hyperledger.fabric_ansible_collection.peer_channel (2.0.7) — module

Manage the list of channels joined by a Hyperledger Fabric peer

Authors: Simon Stone (@sstone1)

preview | supported by community

Install collection

Install with ansible-galaxy collection install hyperledger.fabric_ansible_collection:==2.0.7


Add to requirements.yml

  collections:
    - name: hyperledger.fabric_ansible_collection
      version: 2.0.7

Description

Join a Hyperledger Fabric peer to a channel.

This module works with the IBM Support for Hyperledger Fabric software or the Hyperledger Fabric Open Source Stack running in a Red Hat OpenShift or Kubernetes cluster.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Join the peer to the channel
  hyperledger.fabric_ansible_collection.peer_channel:
    state: present
    api_endpoint: https://console.example.org:32000
    api_authtype: basic
    api_key: xxxxxxxx
    api_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    peer: Org1 Peer
    identity: Org1 Admin.json
    msp_id: Org1MSP
    path: channel_genesis_block.bin
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure the peer is not joined to the channel
  hyperledger.fabric_ansible_collection.peer_channel:
    state: absent
    api_endpoint: https://console.example.org:32000
    api_authtype: basic
    api_key: xxxxxxxx
    api_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    peer: Org1 Peer
    identity: Org1 Admin.json
    msp_id: Org1MSP
    name: channel1

Inputs

    
hsm:
    description:
    - 'The PKCS #11 compliant HSM configuration to use for digital signatures.'
    - Only required if the identity specified in I(identity) was enrolled using an HSM.
    suboptions:
      label:
        description:
        - The HSM label that should be used for digital signatures.
        type: str
      pin:
        description:
        - The HSM pin that should be used for digital signatures.
        type: str
      pkcs11library:
        description:
        - 'The PKCS #11 library that should be used for digital signatures.'
        type: str
    type: dict

name:
    description:
    - The name of the channel.
    - Only required when I(state) is C(absent).
    type: str

path:
    description:
    - The path to the file where the channel genesis block is stored.
    - Only required when I(state) is C(present).
    type: str

peer:
    description:
    - The peer to join to the channel.
    - You can pass a string, which is the display name of a peer registered with the Fabric
      operations console.
    - You can also pass a dict, which must match the result format of one of the M(peer_info)
      or M(peer) modules.
    required: true
    type: raw

state:
    choices:
    - absent
    - present
    default: present
    description:
    - C(absent) - If the peer has joined the channel with the specified name, then an
      error will be thrown, as it is not possible for a peer to leave a channel.
    - C(present) - Asserts that the peer has joined the channel with the specified name.
      If the peer has not joined the channel with the specified name, then the peer will
      be joined to the channel using the specified configuration block.
    type: str

msp_id:
    description:
    - The MSP ID to use for interacting with the peer.
    required: true
    type: str

api_key:
    description:
    - The API key for the Fabric operations console.
    required: true
    type: str

identity:
    description:
    - The identity to use when interacting with the peer.
    - You can pass a string, which is the path to the JSON file where the enrolled identity
      is stored.
    - You can also pass a dict, which must match the result format of one of the M(enrolled_identity_info)
      or M(enrolled_identity) modules.
    required: true
    type: raw

api_secret:
    description:
    - The API secret for the Fabric operations console.
    - Only required when I(api_authtype) is C(basic).
    type: str

api_timeout:
    default: 60
    description:
    - The timeout, in seconds, to use when interacting with the Fabric operations console.
    type: int

api_authtype:
    description:
    - C(basic) - Authenticate to the Fabric operations console using basic authentication.
      You must provide both a valid API key using I(api_key) and API secret using I(api_secret).
    required: true
    type: str

api_endpoint:
    description:
    - The URL for the Fabric operations console.
    required: true
    type: str