..
.. SPDX-License-Identifier: Apache-2.0
..

:github_url: https://github.com/IBM-Blockchain/ansible-collection/edit/main/plugins/modules/channel_policy.py


channel_policy -- Manage a policy for a Hyperledger Fabric channel
==================================================================

.. contents::
   :local:
   :depth: 1


Synopsis
--------

Add, update, and remove policies for a Hyperledger Fabric channel by using the IBM Blockchain Platform.

This module works with the IBM Blockchain Platform managed service running in IBM Cloud, or the IBM Blockchain Platform software running in a Red Hat OpenShift or Kubernetes cluster.






Parameters
----------

  state
    ``absent`` - An policy matching the specified name will be removed from the channel.

    ``present`` - Asserts that an policy matching the specified name and configuration exists in the channel. If no policy matches the specified name, the policy will be added to the channel. If an policy matches the specified name but the configuration does not match, then the policy in the channel will be updated.

    | **Type**: str
    | **Default value**: ``present``

  path (required)
    Path to current the channel configuration file.

    This file can be fetched by using the :ref:`channel_config <channel_config_module>` module.

    This file will be updated in place. You will need to keep a copy of the original file for computing the configuration update.

    | **Type**: str

  name (required)
    The name of the policy to add, update, or remove from the channel.

    | **Type**: str

  policy (required)
    The policy to add, update, or remove from the channel.

    You can pass a string, which is a path to a JSON file containing a policy 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).

    Only required when *state* is ``present``.

    | **Type**: raw








Examples
--------

.. code-block:: yaml+jinja

    
    - name: Add the policy to the channel
      ibm.blockchain_platform.channel_policy:
        state: present
        name: Admins
        policy: admins-policy.json
        path: channel_config.bin

    - name: Remove the policy to the channel
      ibm.blockchain_platform.channel_policy:
        state: absent
        name: Admins
        path: channel_config.bin



