diff --git a/bkk01 b/bkk01 index e8f6c15..391aac5 100644 --- a/bkk01 +++ b/bkk01 @@ -15,6 +15,7 @@ bkk00 [polkadot] ksm01 dot01 +pso01 [proxmox_hosts] bkk01 diff --git a/bkk02 b/bkk02 index 395a446..8402f9e 100644 --- a/bkk02 +++ b/bkk02 @@ -15,6 +15,7 @@ bkk00 [polkadot] dot02 ksm02 +pso02 [proxmox_hosts] bkk02 diff --git a/group_vars/polkadot.yaml b/group_vars/polkadot.yaml index 0aec2c2..78962e3 100644 --- a/group_vars/polkadot.yaml +++ b/group_vars/polkadot.yaml @@ -14,6 +14,7 @@ default_base_path: /opt/polkadot default_database_path: "/opt/polkadot/chains" default_log_level: info default_network: polkadot +default_chain_spec: "{{ default_base_path }}/paseo.json" default_node_type: validator # pruning options: archive(rpc), archive-canonical(rpc/finalized) 256(default), 1000(validator) # default_pruning: 1000 diff --git a/host_vars/bkk01.yaml b/host_vars/bkk01.yaml index fed2b1d..33df12c 100644 --- a/host_vars/bkk01.yaml +++ b/host_vars/bkk01.yaml @@ -51,7 +51,7 @@ lxc_nodes: hostname: "{{ hostvars['ksm01']['host_name'] }}" ostemplate: 'local:vztmpl/{{ default_container_template }}' netif: "{{ hostvars['ksm01']['netif'] }}" - cores: 4 + cores: 2 memory: 30720 swap: 15360 password: "{{ default_password }}" @@ -71,4 +71,30 @@ lxc_nodes: - from_port: "{{ hostvars['ksm01']['default_p2p_port'] }}" to_host: "{{ hostvars['ksm01']['container_ip'] }}:{{ hostvars['ksm01']['default_p2p_port'] }}" protocol: "tcp" + - host: "pso01" + proxmox_config: + vmid: "141" + hostname: "{{ hostvars['pso01']['host_name'] }}" + ostemplate: 'local:vztmpl/{{ default_container_template }}' + netif: "{{ hostvars['pso01']['netif'] }}" + cores: 2 + memory: 16384 + swap: 16384 + password: "{{ default_password }}" + disk: "{{ default_storage }}:20" + mounts: '{"mp0":"{{ default_storage }}:80,mp={{ hostvars["pso01"]["default_base_path"] }}"}' + onboot: True + unprivileged: True + validate_certs: False + description: "kusama validator node: {{ hostvars['pso01']['host_name'] }}" + state: present + features: + - nesting=1 + port_forwards: + - from_port: "{{ hostvars['pso01']['ansible_port'] }}" + to_host: "{{ hostvars['pso01']['container_ip'] }}:22" + protocol: "tcp" + - from_port: "{{ hostvars['pso01']['default_p2p_port'] }}" + to_host: "{{ hostvars['pso01']['container_ip'] }}:{{ hostvars['pso01']['default_p2p_port'] }}" + protocol: "tcp" ... diff --git a/host_vars/bkk02.yaml b/host_vars/bkk02.yaml index f59c1de..0d3a2c8 100644 --- a/host_vars/bkk02.yaml +++ b/host_vars/bkk02.yaml @@ -71,4 +71,30 @@ lxc_nodes: - from_port: "{{ hostvars['ksm02']['default_p2p_port'] }}" to_host: "{{ hostvars['ksm02']['container_ip'] }}:{{ hostvars['ksm02']['default_p2p_port'] }}" protocol: "tcp" + - host: "pso02" + proxmox_config: + vmid: "142" + hostname: "{{ hostvars['pso02']['host_name'] }}" + ostemplate: 'local:vztmpl/{{ default_container_template }}' + netif: "{{ hostvars['pso02']['netif'] }}" + cores: 2 + memory: 16384 + swap: 16384 + password: "{{ default_password }}" + disk: "{{ default_storage }}:20" + mounts: '{"mp0":"{{ default_storage }}:80,mp={{ hostvars["pso02"]["default_base_path"] }}"}' + onboot: True + unprivileged: True + validate_certs: False + description: "kusama validator node: {{ hostvars['pso02']['host_name'] }}" + state: present + features: + - nesting=1 + port_forwards: + - from_port: "{{ hostvars['pso02']['ansible_port'] }}" + to_host: "{{ hostvars['pso02']['container_ip'] }}:22" + protocol: "tcp" + - from_port: "{{ hostvars['pso02']['default_p2p_port'] }}" + to_host: "{{ hostvars['pso02']['container_ip'] }}:{{ hostvars['pso02']['default_p2p_port'] }}" + protocol: "tcp" ... diff --git a/host_vars/pso01.yaml b/host_vars/pso01.yaml new file mode 100644 index 0000000..d469bbc --- /dev/null +++ b/host_vars/pso01.yaml @@ -0,0 +1,28 @@ +--- +ansible_host: "27.131.160.106" +container_ip: "192.168.69.141" +ansible_port: "2141" +host_name: "pso01.rotko.net" +host_timezone: "Asia/Bangkok" +netif: '{"net0":"name=eth0,gw={{ default_nat_network_forward_cidr.split("/")[0] }},ip={{ default_host_ip }}/24,bridge={{ default_nat_device }}"}' +role: "polkadot" +pinned_service: True + +# Variables + +default_telemetry_name: "Rotko Networks - {{ host_name.split('.')[0] }} {{ default_node_type | capitalize }}" +default_network: "paseo" +default_chain_spec: "{{ default_base_path }}/paseo.raw.json" +default_chain_spec_dl_url: "https://raw.githubusercontent.com/paseo-network/runtimes/main/chain-specs/paseo.raw.json" +default_node_type: "validator" +default_pruning: 1000 +default_database: paritydb +default_syncmode: warp +default_p2p_port: 33141 +default_p2p_port_ws: 34141 +default_p2p_port_wss: 35141 +default_rpc_port: 9141 +default_secure_rpc_port: 42141 +default_prom_port: 7141 +zabbix_ext_port: 10141 +... diff --git a/host_vars/pso02.yaml b/host_vars/pso02.yaml new file mode 100644 index 0000000..dc94e11 --- /dev/null +++ b/host_vars/pso02.yaml @@ -0,0 +1,28 @@ +--- +ansible_host: "27.131.160.106" +container_ip: "192.168.69.142" +ansible_port: "2142" +host_name: "pso02.rotko.net" +host_timezone: "Asia/Bangkok" +netif: '{"net0":"name=eth0,gw={{ default_nat_network_forward_cidr.split("/")[0] }},ip={{ default_host_ip }}/24,bridge={{ default_nat_device }}"}' +role: "polkadot" +pinned_service: True + +# Variables + +default_telemetry_name: "Rotko Networks - {{ host_name.split('.')[0] }} {{ default_node_type | capitalize }}" +default_network: "paseo" +default_chain_spec: "{{ default_base_path }}/paseo.raw.json" +default_chain_spec_dl_url: "https://raw.githubusercontent.com/paseo-network/runtimes/main/chain-specs/paseo.raw.json" +default_node_type: "validator" +default_pruning: 1000 +default_database: paritydb +default_syncmode: warp +default_p2p_port: 33142 +default_p2p_port_ws: 34142 +default_p2p_port_wss: 35142 +default_rpc_port: 9142 +default_secure_rpc_port: 42142 +default_prom_port: 7142 +zabbix_ext_port: 10142 +... diff --git a/roles/setup_install_polkadot/tasks/main.yaml b/roles/setup_install_polkadot/tasks/main.yaml index 5aafc12..171d12b 100644 --- a/roles/setup_install_polkadot/tasks/main.yaml +++ b/roles/setup_install_polkadot/tasks/main.yaml @@ -32,6 +32,16 @@ - name: Gather facts ansible.builtin.setup: +- name: Check if default network is Paseo + set_fact: + is_paseo_network: "{{ default_network == 'paseo' }}" + +- name: Download Paseo chain spec + get_url: + url: "{{ default_chain_spec_dl_url }}" + dest: "{{ default_chain_spec }}" + when: is_paseo_network + - name: Copy Polkadot systemd service for specific node type ansible.builtin.template: src: "{{ 'polkadot_' + default_node_type + '.service.j2' }}" diff --git a/roles/setup_install_polkadot/templates/polkadot_bootnode.service.j2 b/roles/setup_install_polkadot/templates/polkadot_bootnode.service.j2 index a1511cf..3ca4aa0 100644 --- a/roles/setup_install_polkadot/templates/polkadot_bootnode.service.j2 +++ b/roles/setup_install_polkadot/templates/polkadot_bootnode.service.j2 @@ -8,7 +8,11 @@ User={{ default_user }} Group={{ default_group }} ExecStart={{ default_base_path }}/polkadot \ --name "{{ default_telemetry_name }}" \ - --chain {{ default_network }} \ +{% if default_network == 'paseo' %} + --chain-spec {{ default_chain_spec }} \ +{% else %} + --chain {{ default_network }} \ +{% endif %} --base-path {{ default_base_path }} \ --database paritydb \ --state-pruning 256 \ diff --git a/roles/setup_install_polkadot/templates/polkadot_endpoint.service.j2 b/roles/setup_install_polkadot/templates/polkadot_endpoint.service.j2 index e00e9b2..af57cfc 100644 --- a/roles/setup_install_polkadot/templates/polkadot_endpoint.service.j2 +++ b/roles/setup_install_polkadot/templates/polkadot_endpoint.service.j2 @@ -8,7 +8,11 @@ User={{ default_user }} Group={{ default_group }} ExecStart={{ default_base_path }}/polkadot \ --name "{{ default_telemetry_name }}" \ - --chain {{ default_network }} \ +{% if default_network == 'paseo' %} + --chain-spec {{ default_chain_spec }} \ +{% else %} + --chain {{ default_network }} \ +{% endif %} --base-path {{ default_base_path }} \ --database {{ default_database }} \ --state-pruning archive \ diff --git a/roles/setup_install_polkadot/templates/polkadot_validator.service.j2 b/roles/setup_install_polkadot/templates/polkadot_validator.service.j2 index f3b12b4..2516ef8 100644 --- a/roles/setup_install_polkadot/templates/polkadot_validator.service.j2 +++ b/roles/setup_install_polkadot/templates/polkadot_validator.service.j2 @@ -16,7 +16,11 @@ KillSignal=SIGHUP ExecStart={{ default_base_path }}/polkadot \ --validator \ --base-path {{ default_base_path }} \ +{% if default_network == 'paseo' %} + --chain-spec {{ default_chain_spec }} \ +{% else %} --chain {{ default_network }} \ +{% endif %} --database {{ default_database }} \ --name "{{ hostvars[inventory_hostname]['default_telemetry_name'] | default(host_name) }}" \ --telemetry-url 'wss://telemetry-backend.w3f.community/submit 1' \