/
add-new-channel.yaml
116 lines (105 loc) · 4.59 KB
/
add-new-channel.yaml
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
##############################################################################################
# Copyright Accenture. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
##############################################################################################
# This playbook is a subsequent playbook
##########################################################################################
# DO NOT RUN THIS IF YOU HAVE NOT RUN deploy-network.yaml and deployed the Fabric network
# and want to add a new channel to the existing network
##########################################################################################
# This playbook can only be run after all pods and orderers are available
# Please edit the same network.yaml according to the documenation in docs/sourc/operations/add_new_channel_fabric.md.
# Refer the example under platforms/hyperledger-fabric/configurations/samples/network-fabric-add-new-channel.yaml
---
# This will apply to ansible_provisioners. /etc/ansible/hosts should be configured with this group
- hosts: ansible_provisioners
gather_facts: no
no_log: "{{ no_ansible_log | default(false) }}"
tasks:
# delete build directory
- name: Remove build directory
file:
path: "./build"
state: absent
# Create generate_crypto script for each organization
- include_role:
name: "create/crypto_script"
vars:
component_type: "{{ item.type | lower}}"
orderers: "{{ item.services.orderers }}"
loop: "{{ network['organizations'] }}"
# Creating channel artifacts
# This role creates configtx.yaml file as the requirements mentioned in network.yaml
# which is then consumed by configtxgen tool
- include_role:
name: "create/configtx"
vars:
config_file: "./build/configtx.yaml"
# This role generate channeltx
- include_role:
name: "create/channel_artifacts"
vars:
build_path: "./build"
genesis: "{{ item.genesis }}"
channel_name: "{{ item.channel_name | lower}}"
profile_name: "{{ item.channel_name }}"
add_new_org: 'false'
fetch_certs: "true"
loop: "{{ network['channels'] }}"
when: item.channel_status == 'new'
- name: "Create genesis block"
include_role:
name: "create/genesis"
vars:
build_path: "./build"
genesis: "{{ item.genesis }}"
channel_name: "{{ item.channel_name | lower }}"
loop: "{{ network['channels'] }}"
when: item.channel_status == 'new' and '2.5.' in network.version
# This role creates the value file for creating channel from creator organization
# to the vault.
- include_role:
name: "create/channels"
vars:
build_path: "./build"
participants: "{{ item.participants }}"
docker_url: "{{ network.docker.url }}"
loop: "{{ network['channels'] }}"
when: item.channel_status == 'new' and ('2.2.' in network.version or '1.4.' in network.version)
# This role creates the value file for creating channel from creator organization
# to the vault.
- name: Create all create-channel jobs
include_role:
name: "create/osnchannels"
vars:
build_path: "./build"
docker_url: "{{ network.docker.url }}"
loop: "{{ network['channels'] }}"
when: item.channel_status == 'new' and '2.5.' in network.version
# This role creates the value file for joining channel from each participating peer
# to the vault.
- include_role:
name: "create/channels_join"
vars:
build_path: "./build"
participants: "{{ item.participants }}"
docker_url: "{{ network.docker.url }}"
loop: "{{ network['channels'] }}"
when: item.channel_status == 'new'
# This role creates the value file for anchor peer update over channel for
# each organization which is the part of the channel.
- include_role:
name: "create/anchorpeer"
vars:
build_path: "./build"
participants: "{{ item.participants }}"
docker_url: "{{ network.docker.url }}"
loop: "{{ network['channels'] }}"
when: item.channel_status == 'new'
vars: #These variables can be overriden from the command line
privilege_escalate: false #Default to NOT escalate to root privledges
install_os: "linux" #Default to linux OS
install_arch: "amd64" #Default to amd64 architecture
bin_install_dir: "~/bin" #Default to /bin install directory for binaries
add_new_org: 'false' # Default to false as this is for main network creation