hyperledger.fabric_ansible_collection.channel_config (2.0.7) — module

Manage the configuration for a Hyperledger Fabric channel

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

Fetch and update the configuration for a Hyperledger Fabric 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: Create the configuration for a new channel
  hyperledger.fabric_ansible_collection.channel_config:
    api_endpoint: https://console.example.org:32000
    api_authtype: basic
    api_key: xxxxxxxx
    api_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    operation: create
    name: mychannel
    path: channel_config_update.bin
    organizations:
      - Org1
    policies:
      Admins: admins-policy.json
      Readers: readers-policy.json
      Writers: writers-policy.json
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Fetch the channel configuration
  hyperledger.fabric_ansible_collection.channel_config:
    api_endpoint: https://console.example.org:32000
    api_authtype: basic
    api_key: xxxxxxxx
    api_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    ordering_service: Ordering Service
    identity: Org1 Admin.json
    msp_id: Org1MSP
    operation: fetch
    name: mychannel
    path: channel_config.bin
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Compute the configuration update for the channel
  hyperledger.fabric_ansible_collection.channel_config:
    operation: compute_update
    name: mychannel
    original: original_channel_config.bin
    updated: updated_channel_config.bin
    path: channel_config_update.bin
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Sign the configuration update for the channel
  hyperledger.fabric_ansible_collection.channel_config:
    operation: sign_update
    identity: Org1 Admin.json
    msp_id: Org1MSP
    name: mychannel
    path: channel_config_update.bin
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Apply the configuration update for the channel
  hyperledger.fabric_ansible_collection.channel_config:
    api_endpoint: https://console.example.org:32000
    api_authtype: basic
    api_key: xxxxxxxx
    api_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    ordering_service: Ordering Service
    identity: Org1 Admin.json
    msp_id: Org1MSP
    operation: apply_update
    name: mychannel
    path: channel_config_update.bin

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,
      and when I(operation) is C(fetch), C(sign), or C(apply_update).
    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

acls:
    description:
    - The set of ACLs to add to the new channel. The keys are the ACL names, and the values
      are the name of the policy used by the ACL.
    type: dict

name:
    description:
    - The name of the channel.
    required: true
    type: str

path:
    description:
    - The path to the file where the channel configuration or the channel configuration
      update transaction will be stored.
    required: true
    type: str

msp_id:
    description:
    - The MSP ID to use for interacting with the ordering service or for signing channel
      configuration update transactions.
    - Only required when I(operation) is C(fetch), C(sign), or C(apply_update).
    type: str

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

updated:
    description:
    - The path to the file where the updated channel configuration is stored.
    - Only required when I(operation) is C(compute_update).
    type: str

identity:
    description:
    - The identity to use when interacting with the ordering service or for signing channel
      configuration update transactions.
    - 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.
    - Only required when I(operation) is C(fetch), C(sign_update), or C(apply_update).
    type: raw

original:
    description:
    - The path to the file where the original channel configuration is stored.
    - Only required when I(operation) is C(compute_update).
    type: str

policies:
    description:
    - The set of policies to add to the new channel. The keys are the policy names, and
      the values are the policies.
    - You can pass strings, which are paths to JSON files containing policies in the Hyperledger
      Fabric format (common.Policy).
    - You can also pass a dict, which must correspond to a parsed policy in the Hyperledger
      Fabric format (common.Policy).
    - You must provide at least an Admins, Writers, and Readers policy.
    - Only required when I(operation) is C(create).
    type: dict

operation:
    description:
    - C(create) - Create a channel configuration update transaction for a new channel.
    - C(fetch) - Fetch the current channel configuration to the specified I(path).
    - C(compute_update) - Compute a channel configuration update transaction using the
      original configuration at I(origin) and the updated configuration at I(updated).
    - C(sign_update) - Sign a channel configuration update transaction.
    - C(apply_update) - Apply a channel configuration update transaction.
    required: true
    type: str

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

parameters:
    description:
    - The parameters for the new channel.
    suboptions:
      batch_size:
        description:
        - The batch size parameters for the channel.
        suboptions:
          absolute_max_bytes:
            description:
            - The total size of all the messages in a block for the channel must not exceed
              this value.
            type: int
          max_message_count:
            description:
            - The maximum number of messages that should be present in a block for the
              channel.
            type: int
          preferred_max_bytes:
            description:
            - The total size of all the messages in a block for the channel should not
              exceed this value.
            type: int
        type: dict
      batch_timeout:
        description:
        - The maximum time to wait before cutting a new block for the channel.
        - Example values include I(500ms), I(5m), or I(24h).
        type: str
    type: dict

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

capabilities:
    description:
    - The capability levels for the new channel.
    suboptions:
      application:
        default: V1_4_2
        description:
        - The application capability level for the new channel.
        - The value must be a valid application capability level supported by Hyperledger
          Fabric, and all peers that will join the new channel must support this application
          capability level.
        - Example application capability levels include C(V1_4_2) and C(V2_0).
        type: str
      channel:
        description:
        - The channel capability level.
        - The value must be a valid channel capability level supported by Hyperledger
          Fabric, and all peers and ordering service nodes in the new channel must support
          this channel capability level.
        - Example channel capability levels include C(V1_4_3) and C(V2_0).
        type: str
      orderer:
        description:
        - The orderer capability level for the new channel.
        - The value must be a valid orderer capability level supported by Hyperledger
          Fabric, and all ordering service nodes in the new channel must support this
          orderer capability level.
        - Example orderer capability levels include C(V1_4_2) and C(V2_0).
        type: str
    type: dict

organizations:
    description:
    - The list of organizations to add as members in the new channel.
    - The organizations must all be members of the consortium.
    - You can pass strings, which are the names of organizations that are registered with
      the Fabric operations console.
    - You can also pass a dict, which must match the result format of one of the M(organization_info)
      or M(organization) modules.
    - Only required when I(operation) is C(create).
    elements: raw
    type: list

ordering_service:
    description:
    - The ordering service to use to manage the channel.
    - You can pass a string, which is the cluster name of a ordering service registered
      with the Fabric operations console.
    - You can also pass a list, which must match the result format of one of the M(ordering_service_info)
      or M(ordering_service) modules.
    - Only required when I(operation) is C(fetch) or C(apply_update).
    - Cannot be specified with I(ordering_service_nodes).
    type: raw

ordering_service_nodes:
    description:
    - The ordering service nodes to use to manage the channel.
    - You can pass strings, which are the names of ordering service nodes that are registered
      with the Fabric operations console.
    - You can also pass a dict, which must match the result format of one of the M(ordering_service_node_info)
      or M(ordering_service_node) modules.
    - Only required when I(operation) is C(fetch) or C(apply_update).
    - Cannot be specified with I(ordering_service).
    - If specified when I(operation) is C(create), then the specified ordering service
      nodes are used as the consenters for the channel. This is useful when you want to
      use a subset of nodes in an ordering service; for example, when you only want to
      use three ordering service nodes from a five node ordering service.
    type: raw

tls_handshake_time_shift:
    description:
    - The amount of time to shift backwards for certificate expiration checks during TLS
      handshakes with the ordering service endpoint.
    - Only use this option if the ordering service TLS certificates have expired.
    - The value must be a duration, for example I(30m), I(24h), or I(6h30m).
    type: str

Outputs

path:
  description:
  - The path to the file where the channel configuration or the channel configuration
    update transaction is stored.
  returned: always
  type: str