forked from minhlh/Ansible-Fabric-Starter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.yml
40 lines (31 loc) · 1.79 KB
/
test.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
- hosts: nodes
tasks:
- block:
- name: Set chaincode invoke content
set_fact:
chaincode_update_json: '{"Args":["move", "a", "b", "10"]}'
chaincode_query_json: '{"Args":["query", "a"]}'
invoke_channel_name: "common"
chaincode_name: "reference"
- name: <<UPDATE>> Invoke chaincode on all nodes
raw: "docker exec cli.{{ org }}.{{ global_domain }} bash -c 'peer chaincode invoke --cafile /etc/hyperledger/artifacts/crypto-config/ordererOrganizations/{{ global_domain }}/tlsca/tlsca.{{ global_domain }}-cert.pem --tls -o orderer{{ orderer_id | default() }}.{{ global_domain }}:7050 -C {{ invoke_channel_name }} -n {{ chaincode_name }} -c {{ chaincode_update_json | to_json }}'"
register: chaincode_output
# ignore_errors: true
- name: chaincode output <<UPDATE>>
debug:
var: chaincode_output.stdout_lines
- name: <<QUERY>> Invoke chaincode on all nodes
raw: "docker exec cli.{{ org }}.{{ global_domain }} bash -c 'peer chaincode invoke --cafile /etc/hyperledger/artifacts/crypto-config/ordererOrganizations/{{ global_domain }}/tlsca/tlsca.{{ global_domain }}-cert.pem --tls -o orderer{{ orderer_id | default() }}.{{ global_domain }}:7050 -C {{ invoke_channel_name }} -n {{ chaincode_name }} -c {{ chaincode_query_json | to_json }}'"
register: chaincode_output
# ignore_errors: true
- name: chaincode output <<QUERY>>
debug:
var: chaincode_output.stdout_lines
- name: <<BC INFO>> Show info on channel
raw: "docker exec cli.{{ org }}.{{ global_domain }} bash -c 'peer channel -c {{ invoke_channel_name }} getinfo'"
register: channel_output
ignore_errors: true
- name: channel output <<BC INFO>>
debug:
var: channel_output.stdout_lines
when: "'peer' in node_roles"