forked from hyperledger-labs/minifabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabops.yaml
57 lines (48 loc) · 1.67 KB
/
fabops.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
---
- name: Start fabric operations
hosts: minifab
gather_facts: no
connection: local
vars:
pjroot: "{{ playbook_dir }}"
vars_files:
- "./spec.yaml"
- "./playbooks/ops/opnames.yaml"
tasks:
- set_fact:
allops: "{{ mode.split(',')|list }}"
status_flag: "Success"
current_location_hash: "{{ hostroot | hash('sha256') }}"
- set_fact:
CLINAME: "{{ current_location_hash[:10] }}_cli"
NETNAME: "{{ current_location_hash[:10] }}_net"
- name: Remove approve and commit from the operation list if release is less than 2.0
set_fact:
allops: "{{ allops | difference(['ccapprove', 'cccommit']) }}"
OPNAMES: "{{ OPNAMES | combine({'ccinstantiate': 'cc instantiate'}) }}"
when: IMAGETAG is version('2.0', '<')
- meta: end_play
when: allops|length == 0
- set_fact:
msgops: "{{ (msgops|default([])) + [OPNAMES[item]] }}"
with_items: "{{ allops }}"
- name: "Preparing for the following operations:"
debug:
msg: "{{ msgops|join(', ') }}"
when: msgops|length > 1
tags: [print_action]
- name: "Process configuration"
include_tasks: "playbooks/common/config_apply.yaml"
- name: Check if external node endpoint exists
stat:
path: "{{ pjroot }}/vars/ext_node_vars.json"
register: exflag
- name: "Load external node vars"
include_vars: "{{ pjroot }}/vars/ext_node_vars.json"
when: exflag.stat.exists == true
- name: Do all the requested fabric operations
include_tasks: "playbooks/ops/opwrapper.yaml"
loop: "{{ allops }}"
loop_control:
loop_var: op
when: status_flag == "Success"