-
Notifications
You must be signed in to change notification settings - Fork 719
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2617 from saurabhkumarkardam/quorum-2614
[quorum] refactor quorum ansible codebase
- Loading branch information
Showing
27 changed files
with
311 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,7 +267,8 @@ | |
"type": "string", | ||
"enum": [ | ||
"21.4.2", | ||
"23.4.0" | ||
"23.4.0", | ||
"24.4.1" | ||
] | ||
}, | ||
"env": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
platforms/quorum/configuration/roles/check/validation/tasks/count_validators.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
############################################################################################## | ||
# Copyright Accenture. All Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
############################################################################################## | ||
|
||
# Counting the number of validator nodes | ||
- name: "Count validator nodes" | ||
set_fact: | ||
total_validators: "{{ total_validators | int + 1 }}" | ||
loop: "{{ validators }}" | ||
loop_control: | ||
loop_var: validator | ||
when: validator is defined |
26 changes: 26 additions & 0 deletions
26
platforms/quorum/configuration/roles/check/validation/tasks/main.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
############################################################################################## | ||
# Copyright Accenture. All Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
############################################################################################## | ||
|
||
# Set initial counter for validators | ||
- name: Set initial validator count | ||
set_fact: | ||
total_validators: 0 | ||
|
||
# Count Validato nodes in the first organization | ||
- name: Count Validato nodes in the first organization | ||
include_tasks: count_validators.yaml | ||
vars: | ||
org: "{{ network['organizations'] | first }}" | ||
validators: "{{ org.services.validators }}" | ||
|
||
# Fail if total validators are less than 4 | ||
- name: Fail if total validators are less than 4 | ||
fail: | ||
msg: | | ||
The first organization, {{ (network['organizations'] | first).name }}, must have at least 4 validators. | ||
The first four validators must be named in the following order: validator-0, validator-1, validator-2, validator-3. | ||
Note: Beyond the initial four, custom names can be defined as needed. | ||
when: (total_validators | int) < 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 5 additions & 25 deletions
30
platforms/quorum/configuration/roles/create/validator_node/tasks/main.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,24 @@ | ||
############################################################################################## | ||
# Copyright Accenture. All Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
############################################################################################## | ||
|
||
# This task creates helm release file for each validator node of organization | ||
- name: Create helm release file for each validator node of organization | ||
# Create value file for validator node | ||
- name: Create value file for validator node | ||
include_role: | ||
name: create/helm_component | ||
vars: | ||
component_name: "{{ peer.name }}" | ||
type: "validatorquorum" | ||
loop: "{{ org.services.validators }}" | ||
loop_control: | ||
loop_var: peer | ||
when: org.services.validators is defined | ||
type: "validator_quorum" | ||
|
||
# Git Push : Pushes the above generated files to git | ||
- name: Git Push | ||
include_role: | ||
name: "{{ playbook_dir }}/../../shared/configuration/roles/git_push" | ||
vars: | ||
GIT_DIR: "{{ playbook_dir }}/../../../" | ||
msg: "[ci skip] Pushing Validator files" | ||
when: org.services.validators is defined | ||
msg: "[ci skip] Pushing Validator Helm release file" | ||
|
||
# Wait for the last validator to be running | ||
- name: "Wait for the last validator to run" | ||
include_role: | ||
name: "{{ playbook_dir }}/../../shared/configuration/roles/check/helm_component" | ||
vars: | ||
validator: "{{ org.services.validators | last }}" | ||
label_selectors: | ||
- app.kubernetes.io/release = {{ validator.name | lower }} | ||
- app.kubernetes.io/release = {{ component_name }} | ||
component_type: "Pod" | ||
namespace: "{{ component_ns }}" | ||
when: org.services.validators is defined | ||
|
||
# Get the Genesis and staticnodes | ||
- name: Get genesis and staticnodes | ||
include_role: | ||
name: get/genesis | ||
when: org.services.validators is defined |
25 changes: 25 additions & 0 deletions
25
platforms/quorum/configuration/roles/delete/local_directories/tasks/main.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
############################################################################################## | ||
# Copyright Accenture. All Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
############################################################################################## | ||
|
||
# Find and delete .json files in platforms/quorum/charts/quorum-genesis/files directory | ||
- name: "Find .json files in quorum-genesis files directory" | ||
find: | ||
paths: "{{ playbook_dir }}/../../quorum/charts/quorum-genesis/files" | ||
patterns: "*.json" | ||
register: genesis_and_static_node | ||
|
||
# Delete .json files in quorum-genesis files directory | ||
- name: "Delete .json files in quorum-genesis files directory" | ||
file: | ||
path: "{{ item.path }}" | ||
state: absent | ||
loop: "{{ genesis_and_static_node.files }}" | ||
|
||
# Delete the build directory in platforms/quorum/configuration | ||
- name: "Remove build directory from configuration" | ||
file: | ||
path: "{{ playbook_dir }}/../../quorum/configuration/build" | ||
state: absent |
Oops, something went wrong.