forked from minhlh/Ansible-Fabric-Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.yml
39 lines (30 loc) · 1.8 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
- 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_channel_name }}"
- name: <<UPDATE>> Invoke chaincode on all nodes
raw: "docker exec cli.{{ org }}.{{ domain }} bash -c 'peer chaincode invoke --cafile /etc/hyperledger/artifacts/crypto-config/ordererOrganizations/{{ domain }}/orderers/orderer{{ orderer_id | default() }}.{{ domain }}/tls/ca.crt --tls -o orderer{{ orderer_id | default() }}.{{ domain }}:7050 -C {{ invoke_channel_name }} -n {{ chaincode_common_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 }}.{{ domain }} bash -c 'peer chaincode invoke --cafile /etc/hyperledger/artifacts/crypto-config/ordererOrganizations/{{ domain }}/orderers/orderer{{ orderer_id | default() }}.{{ domain }}/tls/ca.crt --tls -o orderer{{ orderer_id | default() }}.{{ domain }}:7050 -C {{ invoke_channel_name }} -n {{ chaincode_common_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 common
raw: "docker exec cli.{{ org }}.{{ 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"