Merge pull request #47 from Consensys/fleet

adding in fleet mode
newDownloadUrl
Joshua Fernandes 12 months ago committed by GitHub
commit 9333b93973
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      defaults/main.yml
  2. 75
      tasks/fleet.yml
  3. 2
      tasks/install.yml
  4. 4
      tasks/main.yml
  5. 12
      templates/config.toml.j2

@ -84,6 +84,14 @@ besu_tx_pool_max_size: 4096
besu_tx_pool_price_bump: 10
besu_tx_pool_retention_hours: 13
# fleet mode plugin
#LEADER/FOLLOWER
besu_plugin_fleet_node_role: ""
besu_plugin_fleet_leader_http_host: ""
beus_plugin_fleet_leader_http_port: 8545
besu_plugin_fleet_follower_http_host: 0.0.0.0
besu_plugin_fleet_follower_http_port: 8545
# privacy
besu_privacy_enabled: "false"
besu_privacy_url: "http://127.0.0.1:8888"

@ -0,0 +1,75 @@
---
- name: Get the default ipv4 address
set_fact:
besu_default_ip: >-
{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] if
hostvars[inventory_hostname]['ansible_default_ipv4']['address'] is
defined else '127.0.0.1' }}
besu_aws_private_ip: ""
besu_gcp_private_ip: ""
besu_azure_private_ip: ""
- name: Check if running on AWS
uri:
url: http://169.254.169.254/latest/meta-data/local-ipv4
method: GET
return_content: yes
status_code: 200
register: aws_private_ip_output
ignore_errors: True
when: (besu_plugin_fleet_node_role=="FOLLOWER")
- name: Set the host ip if we are in AWS
set_fact:
besu_plugin_fleet_follower_http_host: "{{ aws_private_ip_output.content }}"
when: (besu_plugin_fleet_node_role=="FOLLOWER") and
(aws_private_ip_output.status == 200)
- name: Check if running on Azure
uri:
url: http://169.254.169.254/metadata/instance/network/interface/0/ipv4/ipAddress/0/privateIpAddress?api-version=2017-08-01&format=text
method: GET
headers:
Metadata: true
return_content: yes
status_code: 200
register: azure_private_ip_output
ignore_errors: True
when: (besu_plugin_fleet_node_role=="FOLLOWER") and
( aws_private_ip_output.status != 200 )
- name: Set the host ip if we are in Azure
set_fact:
besu_host_ip: "{{ azure_private_ip_output.content }}"
when: (besu_plugin_fleet_node_role=="FOLLOWER") and
( aws_private_ip_output.status != 200 ) and
( azure_private_ip_output.status == 200 )
- name: Check if running on GCP
uri:
url: http://169.254.169.254/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/ip
method: GET
headers:
Metadata-Flavor: Google
return_content: yes
status_code: 200
register: gcp_private_ip_output
ignore_errors: True
when: (besu_plugin_fleet_node_role=="FOLLOWER") and
( aws_private_ip_output.status != 200 ) and
( azure_private_ip_output.status != 200 )
- name: Set the host ip if we are in GCP
set_fact:
besu_host_ip: "{{ gcp_private_ip_output.content }}"
when: ( aws_private_ip_output.status != 200 ) and
( azure_private_ip_output.status != 200 ) and
( gcp_private_ip_output == 200 )
- name: Fallback to the ansible default ip
set_fact:
besu_host_ip: "{{ besu_default_ip }}"
when: ( aws_private_ip_output.status != 200 ) and
( azure_private_ip_output.status != 200 ) and
( gcp_private_ip_output != 200 )

@ -57,7 +57,7 @@
- name: Create a symlink to current
file:
src: "{{ besu_install_dir }}/"
src: "{{ besu_install_dir }}/"v
dest: "{{ besu_current_dir }}"
state: link
become: true

@ -46,6 +46,10 @@
include_tasks: "network.yml"
when: not besu_host_ip
- name: Get private IP address to bind to if not provided for fleet mode
include_tasks: "fleet.yml"
when: not besu_plugin_fleet_node_role
- name: Create config
include_tasks: "config.yml"

@ -181,6 +181,18 @@ privacy-marker-transaction-signing-key-file="{{besu_privacy_marker_tx_signing_ke
{% endif %}
{% endif %}
{% if besu_plugin_fleet_node_role != "" %}
{% if besu_plugin_fleet_node_role == "LEADER" %}
plugin-fleet-node-role="LEADER"
{% else %}
plugin-fleet-node-role="FOLLOWER"
plugin-fleet-leader-http-host="{{besu_plugin_fleet_leader_http_host}}"
plugin-fleet-leader-http-port={{beus_plugin_fleet_leader_http_port}}
plugin-fleet-follower-http-host="{{besu_plugin_fleet_follower_http_host}}"
plugin-fleet-leader-http-port={{besu_plugin_fleet_follower_http_port}}
{% endif %}
{% endif %}
{% if besu_xdns_enabled|bool == True %}
Xdns-enabled=true
Xdns-update-enabled=true

Loading…
Cancel
Save