Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[substrate] replace ansible roles readme with inline code comments #2413

Merged
merged 2 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions platforms/substrate/configuration/cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
###########################################################################################
# THIS PLAYBOOK DELETES EVERYTHING, EVEN NAMESPACES and FLUX
###########################################################################################

---
# This will apply to ansible_provisioners. /etc/ansible/hosts should be configured with this group
# 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) }}"
Expand All @@ -26,13 +27,15 @@
kubernetes: "{{ item.k8s }}"
loop: "{{ network['organizations'] }}"

# delete build directory
# Delete build directory
- name: Remove build directory
file:
path: "./build"
state: absent
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

# These variables can be overriden from the command line
vars:
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
38 changes: 22 additions & 16 deletions platforms/substrate/configuration/deploy-network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,30 @@
# SPDX-License-Identifier: Apache-2.0
##############################################################################################

##############################################################################################
# This playbook deploys a DLT network on existing Kubernetes clusters
# The Kubernetes clusters should already be created and the infomation to connect to the
# clusters be updated in the network.yaml file that is used as an input to this playbook
###########################################################################################
##############################################################################################

##############################################################################################
# To Run this playbook from this directory, use the following command (network.yaml also in this directory)
# ansible-playbook deploy-network.yaml -e "@./network.yaml"
############################################################################################
##############################################################################################


# Please ensure that the ../../shared/configuration playbooks have been run using the same network.yaml
- hosts: ansible_provisioners
gather_facts: no
no_log: "{{ no_ansible_log | default(false) }}"
tasks:
# delete build directory
# Delete build directory
- name: Remove build directory
file:
path: "./build"
state: absent

# create namespace, service account and clusterrolebinding
# Create namespace, service account and clusterrolebinding
- name: "Create namespace and service account"
include_role:
name: create/namespace_serviceaccount
Expand Down Expand Up @@ -85,7 +90,7 @@
loop: "{{ network['organizations']}}"
when: network.env.proxy == "ambassador"

# This role generates the key materials and stores them in vault
# Generate the key materials and stores them in vault
- name: "Generate key materials for Nodes"
include_role:
name: create/keys
Expand All @@ -102,7 +107,7 @@
kubernetes: "{{ item.k8s }}"
loop: "{{ network['organizations'] }}"

# This role generates the genesis.json for all orgs of the network
# Generate the genesis.json for all orgs of the network
- name: "Generate genesis for the network"
include_role:
name: create/genesis
Expand All @@ -111,7 +116,7 @@
sudo_org_query: "organizations[?type=='superuser']"
org: "{{ network | json_query(sudo_org_query) | first }}"

# This role deploys Substrate bootnodes
# Deploy Substrate bootnodes
- name: "Deploy Bootnodes"
include_role:
name: create/bootnode
Expand All @@ -123,12 +128,12 @@
peers: "{{ item.services.peers }}"
loop: "{{ network['organizations'] }}"

# This role generates the bootnode list file
# Generate the bootnode list file
- name: "Generate bootnode file list for the network"
include_role:
name: create/bootnodefile

# This role deploys Substrate validator nodes
# Deploy Substrate validator nodes
- name: "Deploy Substrate validators"
include_role:
name: create/validator_node
Expand Down Expand Up @@ -158,13 +163,13 @@
loop: "{{ network['organizations'] }}"
when: network.config.node_image == "inteli-poc/dscp-node"

# This role generates the ipfsbootnode list file
# Generate the ipfsbootnode list file
- name: "Generate ipfsbootnode file list for the network"
include_role:
name: create/ipfsbootnodefile
when: network.config.node_image == "inteli-poc/dscp-node"

# This role deploys Substrate member nodes
# Deploy Substrate member nodes
- name: "Deploy Substrate members"
include_role:
name: create/member_node
Expand All @@ -177,8 +182,9 @@
peers: "{{ item.services.peers }}"
loop: "{{ network['organizations'] }}"

vars: #These variables can be overriden from the command line
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
# These variables can be overriden from the command line
vars:
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 # 'add_new_org' flag, defaults to false when not defined.
7 changes: 0 additions & 7 deletions platforms/substrate/configuration/roles/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-License-Identifier: Apache-2.0
##############################################################################################

# This task creates the Bootnode value file for node helm chart
# Create the Bootnode value file for node helm chart
- name: Create value file for bootnode
include_role:
name: create/helm_component
Expand All @@ -27,7 +27,7 @@
loop_var: peer
when: peer.type == "bootnode"

# Git Push : Pushes the above generated files to git directory
# Git Push : Push the above generated files to git directory
- name: Git Push
include_role:
name: "{{ playbook_dir }}/../../shared/configuration/roles/git_push"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-License-Identifier: Apache-2.0
##############################################################################################

# This task fetches the bootnode's peer id from vault
# Fetch the bootnode's peer id from vault
- name: Fetch bootnode peer id from vault
shell: |
vault kv get -field=node_id {{ vault.secret_path | default('secretsv2') }}/{{ component_ns }}/{{ peer.name }}/substrate
Expand All @@ -13,6 +13,7 @@
VAULT_TOKEN: "{{ vault.root_token }}"
register: node_id

# Collect Bootnode data if there is no ingress controller
- name: Collect Bootnode data
set_fact:
node_list={{ node_list|default([]) + [ {'bootnode_id':node_id.stdout, 'external_url':internal_url, 'p2p_port':peer.p2p.port} ] }}
Expand All @@ -21,6 +22,7 @@
when:
- network.env.proxy == 'none'

# Collect Bootnode data if Ambassador is there as ingress controller
- name: Collect Bootnode data
set_fact:
node_list={{ node_list|default([]) + [ {'bootnode_id':node_id.stdout, 'external_url':external_url, 'p2p_port':peer.p2p.ambassador} ] }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
loop_control:
loop_var: org

# This task creates a file, if it doesn't exist, to store bootnode information
# Create a file, if it doesn't exist, to store bootnode information
- name: Create bootnode file
template:
src: "bootnode.tpl"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
# SPDX-License-Identifier: Apache-2.0
##############################################################################################

##############################################################################################
# This role generates certificates for ambassador
# and places them in vault. Certificates are created using openssl
# This also creates the Kubernetes secrets
##############################################################################################

---
# check if ambassadortls dir is there
- name: "check if dir exists or not"
Expand Down Expand Up @@ -34,7 +37,6 @@
- notest

# Gets the existing ambassador tls certs

- name: Get ambassador and tls certs from Vault
shell: |
vault kv get -format=yaml {{ vault.secret_path | default('secretsv2') }}/{{ component_ns }}/tlscerts
Expand All @@ -44,6 +46,7 @@
register: ambassador_tls_certs_yaml
when: not ambassador_tls_certs.failed

# Get ambassador tls certs
- name: Get ambassador tls certs
include_role:
name: "setup/get_crypto"
Expand Down Expand Up @@ -114,7 +117,7 @@
context: "{{ kubernetes.context }}"
register: get_ambassador_secret

# This task creates the Ambassador TLS credentials for ambassador
# Create the Ambassador TLS credentials for ambassador
- name: Create the Ambassador credentials
shell: |
KUBECONFIG={{ kubernetes.config_file }} kubectl create secret tls {{ component_name }}-ambassador-certs --cert={{ ambassadortls }}/ambassador.crt --key={{ ambassadortls }}/ambassador.key -n {{ component_ns }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-License-Identifier: Apache-2.0
##############################################################################################

# generate genesis helmrelease file
# Generate genesis helmrelease file
- name: "Create genesis file"
include_role:
name: create/helm_component
Expand All @@ -13,8 +13,7 @@
name: "{{ org.name | lower }}"
component_name: "{{ org.name }}-genesis-job"

# ---------------------------------------------------------------------
# push the created deployment files to repository
# Push the created deployment files to repository
- name: "Push the created deployment files to repository"
include_role:
name: "{{ playbook_dir }}/../../shared/configuration/roles/git_push"
Expand All @@ -33,7 +32,7 @@
namespace: "{{ component_ns }}"
tags: notest

# This task copies the genesis to the local directory
# Copy the genesis to the local directory
- name: Copy genesis from Vault to local directory
environment:
VAULT_ADDR: "{{ vault.url }}"
Expand Down
Loading