/
06-add-organization-to-consortium.yml
87 lines (80 loc) · 3.32 KB
/
06-add-organization-to-consortium.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#
# SPDX-License-Identifier: Apache-2.0
#
---
- name: Add the organization to the consortium
hosts: localhost
vars_files:
- common-vars.yml
- ordering-org-vars.yml
tasks:
- name: Get the ordering service information
ibm.blockchain_platform.ordering_service_info:
api_endpoint: "{{ api_endpoint }}"
api_authtype: "{{ api_authtype }}"
api_key: "{{ api_key }}"
api_secret: "{{ api_secret | default(omit) }}"
api_token_endpoint: "{{ api_token_endpoint | default(omit) }}"
name: "{{ ordering_service_name }}"
register: ordering_service
- name: Fail if the ordering service does not exist
fail:
msg: "{{ ordering_service_name }} does not exist"
when: not ordering_service.exists
- name: Fetch the system channel configuration
ibm.blockchain_platform.channel_config:
api_endpoint: "{{ api_endpoint }}"
api_authtype: "{{ api_authtype }}"
api_key: "{{ api_key }}"
api_secret: "{{ api_secret | default(omit) }}"
api_token_endpoint: "{{ api_token_endpoint | default(omit) }}"
ordering_service: "{{ ordering_service_name }}"
identity: "{{ ordering_org_name }} Admin.json"
msp_id: "{{ ordering_service_msp }}"
operation: fetch
name: "{{ ordering_service.ordering_service[0].system_channel_id }}"
path: original_config.bin
- name: Create a copy of the system channel configuration
copy:
src: original_config.bin
dest: updated_config.bin
- name: Add the organization to the consortium
ibm.blockchain_platform.consortium_member:
state: present
api_endpoint: "{{ api_endpoint }}"
api_authtype: "{{ api_authtype }}"
api_key: "{{ api_key }}"
api_secret: "{{ api_secret | default(omit) }}"
api_token_endpoint: "{{ api_token_endpoint | default(omit) }}"
organization: "{{ org1_name }}"
path: updated_config.bin
- name: Compute the system channel configuration update
ibm.blockchain_platform.channel_config:
operation: compute_update
name: "{{ ordering_service.ordering_service[0].system_channel_id }}"
original: original_config.bin
updated: updated_config.bin
path: config_update.bin
register: compute_update
- name: Sign the system channel configuration update
ibm.blockchain_platform.channel_config:
operation: sign_update
identity: "{{ ordering_org_name }} Admin.json"
msp_id: "{{ ordering_service_msp }}"
name: "{{ ordering_service.ordering_service[0].system_channel_id }}"
path: config_update.bin
when: compute_update.path
- name: Apply the system channel configuration update
ibm.blockchain_platform.channel_config:
api_endpoint: "{{ api_endpoint }}"
api_authtype: "{{ api_authtype }}"
api_key: "{{ api_key }}"
api_secret: "{{ api_secret | default(omit) }}"
api_token_endpoint: "{{ api_token_endpoint | default(omit) }}"
operation: apply_update
ordering_service: "{{ ordering_service_name }}"
identity: "{{ ordering_org_name }} Admin.json"
msp_id: "{{ ordering_service_msp }}"
name: "{{ ordering_service.ordering_service[0].system_channel_id }}"
path: config_update.bin
when: compute_update.path