Skip to content

Commit f5e2995

Browse files
committed
fix load variables correctly
1 parent df26df2 commit f5e2995

7 files changed

Lines changed: 143 additions & 126 deletions

File tree

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
- name: Deploy Full Aggregation Mode Stack
2-
hosts: localhost
3-
gather_facts: no
1+
- name: Deploy PostgreSQL Cluster
2+
ansible.builtin.import_playbook: postgres_cluster.yaml
3+
vars:
4+
env: "{{ env }}"
45

5-
tasks:
6-
- name: Deploy PostgreSQL Cluster
7-
ansible.builtin.import_playbook: postgres_cluster.yaml
6+
- name: Deploy Gateway and Poller on Primary
7+
ansible.builtin.import_playbook: gateway_stack.yaml
8+
vars:
9+
host: gateway_primary
10+
env: "{{ env }}"
811

9-
- name: Deploy Gateway and Poller on Primary
10-
ansible.builtin.import_playbook: gateway_stack.yaml
11-
vars:
12-
host: gateway_primary
12+
- name: Deploy Gateway and Poller on Secondary
13+
ansible.builtin.import_playbook: gateway_stack.yaml
14+
vars:
15+
host: gateway_secondary
16+
env: "{{ env }}"
1317

14-
- name: Deploy Gateway and Poller on Secondary
15-
ansible.builtin.import_playbook: gateway_stack.yaml
16-
vars:
17-
host: gateway_secondary
18-
19-
- name: Deploy Metrics Stack
20-
ansible.builtin.import_playbook: metrics_stack.yaml
21-
vars:
22-
host: metrics
18+
- name: Deploy Metrics Stack
19+
ansible.builtin.import_playbook: metrics_stack.yaml
20+
vars:
21+
host: metrics
22+
env: "{{ env }}"

infra/aggregation_mode/ansible/playbooks/gateway.yaml

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,46 @@
1+
- name: Import setup playbook
2+
ansible.builtin.import_playbook: setup.yaml
3+
vars:
4+
host: "{{ host }}"
5+
env: "{{ env }}"
6+
7+
- name: Import rust playbook
8+
ansible.builtin.import_playbook: rust.yaml
9+
vars:
10+
host: "{{ host }}"
11+
env: "{{ env }}"
12+
113
- name: Gateway Setup
214
hosts: "{{ host }}"
315

416
tasks:
5-
- name: Import setup playbook
6-
ansible.builtin.import_playbook: setup.yaml
7-
vars:
8-
host: "{{ host }}"
17+
- name: Set config file path
18+
set_fact:
19+
config_file: "ini/config-{{ env }}.ini"
920

10-
- name: Import rust playbook
11-
ansible.builtin.import_playbook: rust.yaml
12-
vars:
13-
host: "{{ host }}"
14-
15-
- hosts: "{{ host }}"
16-
vars:
17-
git_branch: "{{ lookup('ini', 'git_branch', file='ini/config-{{ env }}.ini') }}"
18-
gateway_port: "{{ lookup('ini', 'gateway_port', file='ini/config-{{ env }}.ini', default='8080') }}"
19-
gateway_tls_enabled: "{{ lookup('ini', 'gateway_tls_enabled', file='ini/config-{{ env }}.ini', default='true') }}"
20-
gateway_tls_port: "{{ lookup('ini', 'gateway_tls_port', file='ini/config-{{ env }}.ini', default='443') }}"
21-
gateway_tls_cert_path: "{{ lookup('ini', 'gateway_tls_cert_path', file='ini/config-{{ env }}.ini') }}"
22-
gateway_tls_key_path: "{{ lookup('ini', 'gateway_tls_key_path', file='ini/config-{{ env }}.ini') }}"
23-
gateway_db_user: "{{ lookup('ini', 'gateway_db_user', file='ini/config-{{ env }}.ini') }}"
24-
gateway_db_password: "{{ lookup('ini', 'gateway_db_password', file='ini/config-{{ env }}.ini') }}"
25-
gateway_db_name: "{{ lookup('ini', 'gateway_db_name', file='ini/config-{{ env }}.ini') }}"
26-
gateway_postgres_primary: "{{ lookup('ini', 'gateway_postgres_primary', file='ini/config-{{ env }}.ini') }}"
27-
gateway_postgres_secondary: "{{ lookup('ini', 'gateway_postgres_secondary', file='ini/config-{{ env }}.ini') }}"
28-
gateway_postgres_port: "{{ lookup('ini', 'gateway_postgres_port', file='ini/config-{{ env }}.ini', default='5432') }}"
29-
gateway_eth_rpc_url: "{{ lookup('ini', 'gateway_eth_rpc_url', file='ini/config-{{ env }}.ini') }}"
30-
gateway_payment_service_address: "{{ lookup('ini', 'gateway_payment_service_address', file='ini/config-{{ env }}.ini') }}"
31-
gateway_network: "{{ lookup('ini', 'gateway_network', file='ini/config-{{ env }}.ini') }}"
32-
gateway_max_daily_proofs: "{{ lookup('ini', 'gateway_max_daily_proofs', file='ini/config-{{ env }}.ini', default='100') }}"
33-
gateway_metrics_port: "{{ lookup('ini', 'gateway_metrics_port', file='ini/config-{{ env }}.ini', default='9094') }}"
34-
tls_cert_source_path: "{{ lookup('ini', 'tls_cert_source_path', file='ini/config-{{ env }}.ini') }}"
35-
tls_key_source_path: "{{ lookup('ini', 'tls_key_source_path', file='ini/config-{{ env }}.ini') }}"
21+
- name: Set config vars from INI file
22+
set_fact:
23+
git_branch: "{{ lookup('ini', 'git_branch', file=config_file) }}"
24+
gateway_port: "{{ lookup('ini', 'gateway_port', file=config_file, default='8080') }}"
25+
gateway_tls_enabled: "{{ lookup('ini', 'gateway_tls_enabled', file=config_file, default='true') }}"
26+
gateway_tls_port: "{{ lookup('ini', 'gateway_tls_port', file=config_file, default='443') }}"
27+
gateway_tls_cert_path: "{{ lookup('ini', 'gateway_tls_cert_path', file=config_file) }}"
28+
gateway_tls_key_path: "{{ lookup('ini', 'gateway_tls_key_path', file=config_file) }}"
29+
gateway_db_user: "{{ lookup('ini', 'gateway_db_user', file=config_file) }}"
30+
gateway_db_password: "{{ lookup('ini', 'gateway_db_password', file=config_file) }}"
31+
gateway_db_name: "{{ lookup('ini', 'gateway_db_name', file=config_file) }}"
32+
gateway_postgres_primary: "{{ lookup('ini', 'gateway_postgres_primary', file=config_file) }}"
33+
gateway_postgres_secondary: "{{ lookup('ini', 'gateway_postgres_secondary', file=config_file) }}"
34+
gateway_postgres_port: "{{ lookup('ini', 'gateway_postgres_port', file=config_file, default='5432') }}"
35+
gateway_eth_rpc_url: "{{ lookup('ini', 'gateway_eth_rpc_url', file=config_file) }}"
36+
gateway_payment_service_address: "{{ lookup('ini', 'gateway_payment_service_address', file=config_file) }}"
37+
gateway_network: "{{ lookup('ini', 'gateway_network', file=config_file) }}"
38+
gateway_max_daily_proofs: "{{ lookup('ini', 'gateway_max_daily_proofs', file=config_file, default='100') }}"
39+
gateway_metrics_port: "{{ lookup('ini', 'gateway_metrics_port', file=config_file, default='9094') }}"
40+
tls_cert_source_path: "{{ lookup('ini', 'tls_cert_source_path', file=config_file) }}"
41+
tls_key_source_path: "{{ lookup('ini', 'tls_key_source_path', file=config_file) }}"
42+
no_log: true
3643

37-
tasks:
3844
- name: Install required system packages
3945
become: true
4046
apt:
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
- name: Deploy Gateway and Poller Stack
2-
hosts: "{{ host }}"
1+
- name: Deploy Gateway
2+
ansible.builtin.import_playbook: gateway.yaml
3+
vars:
4+
host: "{{ host }}"
5+
env: "{{ env }}"
36

4-
tasks:
5-
- name: Deploy Gateway
6-
ansible.builtin.import_playbook: gateway.yaml
7-
vars:
8-
host: "{{ host }}"
9-
10-
- name: Deploy Poller
11-
ansible.builtin.import_playbook: poller.yaml
12-
vars:
13-
host: "{{ host }}"
7+
- name: Deploy Poller
8+
ansible.builtin.import_playbook: poller.yaml
9+
vars:
10+
host: "{{ host }}"
11+
env: "{{ env }}"

infra/aggregation_mode/ansible/playbooks/grafana_agg_mode.yaml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
1+
- name: Import setup playbook
2+
ansible.builtin.import_playbook: setup.yaml
3+
vars:
4+
host: "{{ host }}"
5+
env: "{{ env }}"
6+
17
- name: Grafana Setup for Aggregation Mode
28
hosts: "{{ host }}"
39

410
tasks:
5-
- name: Import setup playbook
6-
ansible.builtin.import_playbook: setup.yaml
7-
vars:
8-
host: "{{ host }}"
11+
- name: Set config file path
12+
set_fact:
13+
config_file: "ini/config-{{ env }}.ini"
914

10-
- hosts: "{{ host }}"
11-
vars:
12-
grafana_prometheus_url: "{{ lookup('ini', 'grafana_prometheus_url', file='ini/config-{{ env }}.ini') }}"
13-
grafana_rpc_url: "{{ lookup('ini', 'grafana_rpc_url', file='ini/config-{{ env }}.ini') }}"
14-
grafana_postgres_host: "{{ lookup('ini', 'grafana_postgres_host', file='ini/config-{{ env }}.ini') }}"
15-
grafana_postgres_port: "{{ lookup('ini', 'grafana_postgres_port', file='ini/config-{{ env }}.ini', default='5432') }}"
16-
grafana_postgres_db: "{{ lookup('ini', 'grafana_postgres_db', file='ini/config-{{ env }}.ini') }}"
17-
grafana_postgres_user: "{{ lookup('ini', 'grafana_postgres_user', file='ini/config-{{ env }}.ini') }}"
18-
grafana_postgres_password: "{{ lookup('ini', 'grafana_postgres_password', file='ini/config-{{ env }}.ini') }}"
15+
- name: Set config vars from INI file
16+
set_fact:
17+
grafana_prometheus_url: "{{ lookup('ini', 'grafana_prometheus_url', file=config_file) }}"
18+
grafana_rpc_url: "{{ lookup('ini', 'grafana_rpc_url', file=config_file) }}"
19+
grafana_postgres_host: "{{ lookup('ini', 'grafana_postgres_host', file=config_file) }}"
20+
grafana_postgres_port: "{{ lookup('ini', 'grafana_postgres_port', file=config_file, default='5432') }}"
21+
grafana_postgres_db: "{{ lookup('ini', 'grafana_postgres_db', file=config_file) }}"
22+
grafana_postgres_user: "{{ lookup('ini', 'grafana_postgres_user', file=config_file) }}"
23+
grafana_postgres_password: "{{ lookup('ini', 'grafana_postgres_password', file=config_file) }}"
24+
no_log: true
1925

20-
tasks:
2126
- name: Install required packages
2227
become: true
2328
apt:
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
- name: Deploy Metrics Stack
2-
hosts: "{{ host }}"
1+
- name: Deploy Prometheus
2+
ansible.builtin.import_playbook: prometheus_agg_mode.yaml
3+
vars:
4+
host: "{{ host }}"
5+
env: "{{ env }}"
36

4-
tasks:
5-
- name: Deploy Prometheus
6-
ansible.builtin.import_playbook: prometheus_agg_mode.yaml
7-
vars:
8-
host: "{{ host }}"
9-
10-
- name: Deploy Grafana
11-
ansible.builtin.import_playbook: grafana_agg_mode.yaml
12-
vars:
13-
host: "{{ host }}"
7+
- name: Deploy Grafana
8+
ansible.builtin.import_playbook: grafana_agg_mode.yaml
9+
vars:
10+
host: "{{ host }}"
11+
env: "{{ env }}"

infra/aggregation_mode/ansible/playbooks/poller.yaml

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,41 @@
1+
- name: Import setup playbook
2+
ansible.builtin.import_playbook: setup.yaml
3+
vars:
4+
host: "{{ host }}"
5+
env: "{{ env }}"
6+
7+
- name: Import rust playbook
8+
ansible.builtin.import_playbook: rust.yaml
9+
vars:
10+
host: "{{ host }}"
11+
env: "{{ env }}"
12+
113
- name: Poller Setup
214
hosts: "{{ host }}"
315

416
tasks:
5-
- name: Import setup playbook
6-
ansible.builtin.import_playbook: setup.yaml
7-
vars:
8-
host: "{{ host }}"
17+
- name: Set config file path
18+
set_fact:
19+
config_file: "ini/config-{{ env }}.ini"
920

10-
- name: Import rust playbook
11-
ansible.builtin.import_playbook: rust.yaml
12-
vars:
13-
host: "{{ host }}"
14-
15-
- hosts: "{{ host }}"
16-
vars:
17-
git_branch: "{{ lookup('ini', 'git_branch', file='ini/config-{{ env }}.ini') }}"
18-
poller_db_user: "{{ lookup('ini', 'gateway_db_user', file='ini/config-{{ env }}.ini') }}"
19-
poller_db_password: "{{ lookup('ini', 'gateway_db_password', file='ini/config-{{ env }}.ini') }}"
20-
poller_db_name: "{{ lookup('ini', 'gateway_db_name', file='ini/config-{{ env }}.ini') }}"
21-
poller_postgres_primary: "{{ lookup('ini', 'gateway_postgres_primary', file='ini/config-{{ env }}.ini') }}"
22-
poller_postgres_secondary: "{{ lookup('ini', 'gateway_postgres_secondary', file='ini/config-{{ env }}.ini') }}"
23-
poller_postgres_port: "{{ lookup('ini', 'gateway_postgres_port', file='ini/config-{{ env }}.ini', default='5432') }}"
24-
poller_eth_rpc_url: "{{ lookup('ini', 'gateway_eth_rpc_url', file='ini/config-{{ env }}.ini') }}"
25-
poller_payment_service_address: "{{ lookup('ini', 'gateway_payment_service_address', file='ini/config-{{ env }}.ini') }}"
26-
poller_network: "{{ lookup('ini', 'gateway_network', file='ini/config-{{ env }}.ini') }}"
27-
poller_max_daily_proofs: "{{ lookup('ini', 'gateway_max_daily_proofs', file='ini/config-{{ env }}.ini', default='100') }}"
28-
poller_last_block_fetched_filepath: "{{ lookup('ini', 'poller_last_block_fetched_filepath', file='ini/config-{{ env }}.ini') }}"
29-
last_block_fetched_initial_value: "{{ lookup('ini', 'last_block_fetched_initial_value', file='ini/config-{{ env }}.ini', default='0') }}"
30-
poller_metrics_port: "{{ lookup('ini', 'poller_metrics_port', file='ini/config-{{ env }}.ini', default='9095') }}"
21+
- name: Set config vars from INI file
22+
set_fact:
23+
git_branch: "{{ lookup('ini', 'git_branch', file=config_file) }}"
24+
poller_db_user: "{{ lookup('ini', 'gateway_db_user', file=config_file) }}"
25+
poller_db_password: "{{ lookup('ini', 'gateway_db_password', file=config_file) }}"
26+
poller_db_name: "{{ lookup('ini', 'gateway_db_name', file=config_file) }}"
27+
poller_postgres_primary: "{{ lookup('ini', 'gateway_postgres_primary', file=config_file) }}"
28+
poller_postgres_secondary: "{{ lookup('ini', 'gateway_postgres_secondary', file=config_file) }}"
29+
poller_postgres_port: "{{ lookup('ini', 'gateway_postgres_port', file=config_file, default='5432') }}"
30+
poller_eth_rpc_url: "{{ lookup('ini', 'gateway_eth_rpc_url', file=config_file) }}"
31+
poller_payment_service_address: "{{ lookup('ini', 'gateway_payment_service_address', file=config_file) }}"
32+
poller_network: "{{ lookup('ini', 'gateway_network', file=config_file) }}"
33+
poller_max_daily_proofs: "{{ lookup('ini', 'gateway_max_daily_proofs', file=config_file, default='100') }}"
34+
poller_last_block_fetched_filepath: "{{ lookup('ini', 'poller_last_block_fetched_filepath', file=config_file) }}"
35+
last_block_fetched_initial_value: "{{ lookup('ini', 'last_block_fetched_initial_value', file=config_file, default='0') }}"
36+
poller_metrics_port: "{{ lookup('ini', 'poller_metrics_port', file=config_file, default='9095') }}"
37+
no_log: true
3138

32-
tasks:
3339
- name: Install required system packages
3440
become: true
3541
apt:

infra/aggregation_mode/ansible/playbooks/prometheus_agg_mode.yaml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1+
- name: Import setup playbook
2+
ansible.builtin.import_playbook: setup.yaml
3+
vars:
4+
host: "{{ host }}"
5+
env: "{{ env }}"
6+
17
- name: Prometheus Setup for Aggregation Mode
28
hosts: "{{ host }}"
39

410
tasks:
5-
- name: Import setup playbook
6-
ansible.builtin.import_playbook: setup.yaml
7-
vars:
8-
host: "{{ host }}"
11+
- name: Set config file path
12+
set_fact:
13+
config_file: "ini/config-{{ env }}.ini"
914

10-
- hosts: "{{ host }}"
11-
vars:
12-
prometheus_version: "{{ lookup('ini', 'prometheus_version', file='ini/config-{{ env }}.ini', default='3.6.0') }}"
13-
gateway_primary_hostname: "{{ lookup('ini', 'gateway_primary_hostname', file='ini/config-{{ env }}.ini') }}"
14-
gateway_secondary_hostname: "{{ lookup('ini', 'gateway_secondary_hostname', file='ini/config-{{ env }}.ini') }}"
15-
gateway_metrics_port: "{{ lookup('ini', 'gateway_metrics_port', file='ini/config-{{ env }}.ini', default='9094') }}"
16-
poller_metrics_port: "{{ lookup('ini', 'poller_metrics_port', file='ini/config-{{ env }}.ini', default='9095') }}"
15+
- name: Set config vars from INI file
16+
set_fact:
17+
prometheus_version: "{{ lookup('ini', 'prometheus_version', file=config_file, default='3.6.0') }}"
18+
gateway_primary_hostname: "{{ lookup('ini', 'gateway_primary_hostname', file=config_file) }}"
19+
gateway_secondary_hostname: "{{ lookup('ini', 'gateway_secondary_hostname', file=config_file) }}"
20+
gateway_metrics_port: "{{ lookup('ini', 'gateway_metrics_port', file=config_file, default='9094') }}"
21+
poller_metrics_port: "{{ lookup('ini', 'poller_metrics_port', file=config_file, default='9095') }}"
1722

18-
tasks:
1923
- name: Check if Prometheus is installed
2024
stat:
2125
path: /home/{{ ansible_user }}/prometheus-{{ prometheus_version }}.linux-amd64/prometheus

0 commit comments

Comments
 (0)