1- - import_playbook : setup.yaml
2- - import_playbook : go.yaml
3- - import_playbook : rust.yaml
4- - import_playbook : eigenlayer-cli.yaml
1+ - name : Run setup playbook
2+ ansible.builtin.import_playbook : setup.yaml
3+ vars :
4+ host : operator
5+
6+ - name : Run go playbook
7+ ansible.builtin.import_playbook : go.yaml
8+ vars :
9+ host : operator
10+
11+ - name : Run rust playbook
12+ ansible.builtin.import_playbook : rust.yaml
13+ vars :
14+ host : operator
15+
16+ - name : Run eigenlayer-cli playbook
17+ ansible.builtin.import_playbook : eigenlayer-cli.yaml
18+ vars :
19+ host : operator
520
6- - hosts : aligned-holesky-operator-1
7- become : true
21+ - name : Run foundry playbook
22+ ansible.builtin.import_playbook : foundry.yaml
823 vars :
9- user : " {{ user }}"
24+ host : operator
25+
26+
27+ - hosts : operator
1028
1129 tasks :
12- # Install required packages
30+
1331 - name : Update apt and install required system packages
32+ become : true
1433 apt :
1534 pkg :
1635 - pkg-config
1736 - libssl-dev
18- - gcc
1937 state : latest
2038 update_cache : true
39+ vars :
40+ ansible_ssh_user : " {{ admin_user }}"
2141
22- # Create directories for each service
23- - name : Create directories for each service if do not exist
42+ - name : Create directory for the repository
2443 ansible.builtin.file :
25- path : /home/{{ user }}/repos/{{ item }}
44+ path : /home/{{ ansible_user }}/repos/operator
2645 state : directory
2746 mode : ' 0755'
28- become_user : " {{ user }}"
29- loop :
30- - operator
47+ owner : ' {{ ansible_user }}'
48+ group : ' {{ ansible_user }}'
3149
32- # Clone Aligned repository for each service
3350 - name : Clone Aligned repository
3451 ansible.builtin.git :
3552 repo : https://github.com/yetanotherco/aligned_layer.git
36- dest : /home/{{ user }}/repos/{{ item }} /aligned_layer
53+ dest : /home/{{ ansible_user }}/repos/operator /aligned_layer
3754 version : v0.10.2
38- become_user : " {{ user }}"
39- loop :
40- - operator
55+ recursive : false
56+
57+ - name : Build the Operator
58+ make :
59+ chdir : /home/{{ ansible_user }}/repos/operator/aligned_layer
60+ target : build_operator
61+ environment :
62+ PATH : " {{ ansible_env.PATH }}:/usr/bin:/usr/local/go/bin:/home/{{ ansible_user }}/.cargo/bin"
63+
64+ - name : Copy ECDSA keystore to server
65+ ansible.builtin.copy :
66+ src : ' {{ ecdsa_keystore_path }}'
67+ dest : /home/{{ ansible_user }}/.keystores/operator.ecdsa
68+ owner : ' {{ ansible_user }}'
69+ group : ' {{ ansible_user }}'
70+
71+ - name : Copy BLS keystore to server
72+ ansible.builtin.copy :
73+ src : ' {{ bls_keystore_path }}'
74+ dest : /home/{{ ansible_user }}/.keystores/operator.bls
75+ owner : ' {{ ansible_user }}'
76+ group : ' {{ ansible_user }}'
77+
78+ - name : Create variables
79+ set_fact :
80+ weth_strategy_address : " {{ lookup('ini', 'weth_strategy_address', file='ini/config-register-operator.ini') }}"
81+ address : " {{ lookup('ini', 'address', file='ini/config-register-operator.ini') }}"
82+ eth_rpc_url : " {{ lookup('ini', 'eth_rpc_url', file='ini/config-register-operator.ini') }}"
83+
84+ - name : Check if Operator already staked wETH
85+ ansible.builtin.command : " cast call {{ weth_strategy_address }} shares(address)(uint256) {{ address }} --rpc-url {{ eth_rpc_url }}"
86+ register : operator_stake
87+ environment :
88+ PATH : " {{ ansible_env.PATH }}:/home/{{ ansible_user }}/.foundry/bin"
89+
90+ - name : Upload config file for register Operator
91+ when : operator_stake.stdout == "0"
92+ template :
93+ src : operator/config-register-operator.yaml.j2
94+ dest : " /home/{{ ansible_user }}/config/config-register-operator.yaml"
95+ vars :
96+ address : " {{ lookup('ini', 'address', file='ini/config-register-operator.ini') }}"
97+ metadata_url : " {{ lookup('ini', 'metadata_url', file='ini/config-register-operator.ini') }}"
98+ el_delegation_manager_address : " {{ lookup('ini', 'el_delegation_manager_address', file='ini/config-register-operator.ini') }}"
99+ eth_rpc_url : " {{ lookup('ini', 'eth_rpc_url', file='ini/config-register-operator.ini') }}"
100+ private_key_store_path : " {{ lookup('ini', 'private_key_store_path', file='ini/config-register-operator.ini') }}"
101+ chain_id : " {{ lookup('ini', 'chain_id', file='ini/config-register-operator.ini') }}"
102+
103+ - name : Register Operator in EigenLayer
104+ when : operator_stake.stdout == "0"
105+ shell :
106+ cmd : echo "{{ lookup('ini', 'private_key_store_password', file='ini/config-register-operator.ini') }}" | eigenlayer operator register /home/{{ ansible_user }}/config/config-register-operator.yaml >> register.log 2>&1
107+ environment :
108+ PATH : " {{ ansible_env.PATH }}:/home/{{ ansible_user }}/bin"
109+
110+ - name : Swap holETH for wETH
111+ when : operator_stake.stdout == "0"
112+ shell :
113+ cmd : cast send --value 0.1ether {{ lookup('ini', 'weth_address', file='ini/config-register-operator.ini') }} --password {{ lookup('ini', 'private_key_store_password', file='ini/config-register-operator.ini') }}
114+ environment :
115+ PATH : " {{ ansible_env.PATH }}:/home/{{ ansible_user }}/.foundry/bin"
116+ ETH_KEYSTORE : " {{ lookup('ini', 'private_key_store_path', file='ini/config-register-operator.ini') }}"
117+ ETH_PASSWORD : " {{ lookup('ini', 'private_key_store_password', file='ini/config-register-operator.ini') }}" # It is not working idk why
118+ ETH_RPC_URL : " {{ lookup('ini', 'eth_rpc_url', file='ini/config-register-operator.ini') }}"
119+
120+ - name : Upload config file for Operator
121+ template :
122+ src : config-files/config-operator.yaml.j2
123+ dest : " /home/{{ ansible_user }}/config/config-operator.yaml"
124+ vars :
125+ aligned_layer_deployment_config_file_path : " {{ lookup('ini', 'aligned_layer_deployment_config_file_path', file='ini/config-operator.ini') }}"
126+ eigen_layer_deployment_config_file_path : " {{ lookup('ini', 'eigen_layer_deployment_config_file_path', file='ini/config-operator.ini') }}"
127+ eth_rpc_url : " {{ lookup('ini', 'eth_rpc_url', file='ini/config-operator.ini') }}"
128+ eth_rpc_url_fallback : " {{ lookup('ini', 'eth_rpc_url_fallback', file='ini/config-operator.ini') }}"
129+ eth_ws_url : " {{ lookup('ini', 'eth_ws_url', file='ini/config-operator.ini') }}"
130+ eth_ws_url_fallback : " {{ lookup('ini', 'eth_ws_url_fallback', file='ini/config-operator.ini') }}"
131+ ecdsa_private_key_store_path : " {{ lookup('ini', 'ecdsa_private_key_store_path', file='ini/config-operator.ini') }}"
132+ ecdsa_private_key_store_password : " {{ lookup('ini', 'ecdsa_private_key_store_password', file='ini/config-operator.ini') }}"
133+ bls_private_key_store_path : " {{ lookup('ini', 'bls_private_key_store_path', file='ini/config-operator.ini') }}"
134+ bls_private_key_store_password : " {{ lookup('ini', 'bls_private_key_store_password', file='ini/config-operator.ini') }}"
135+ aggregator_rpc_server_ip_port_address : " {{ lookup('ini', 'aggregator_rpc_server_ip_port_address', file='ini/config-operator.ini') }}"
136+ operator_tracker_ip_port_address : " {{ lookup('ini', 'operator_tracker_ip_port_address', file='ini/config-operator.ini') }}"
137+ address : " {{ lookup('ini', 'address', file='ini/config-operator.ini') }}"
138+ metadata_url : " {{ lookup('ini', 'metadata_url', file='ini/config-operator.ini') }}"
139+ enable_metrics : " {{ lookup('ini', 'enable_metrics', file='ini/config-operator.ini') }}"
140+ metrics_ip_port_address : " {{ lookup('ini', 'metrics_ip_port_address', file='ini/config-operator.ini') }}"
141+ last_processed_batch_filepath : " {{ lookup('ini', 'last_processed_batch_filepath', file='ini/config-operator.ini') }}"
142+
143+ - name : Deposit into wETH strategy
144+ when : operator_stake.stdout == "0"
145+ make :
146+ chdir : /home/{{ ansible_user }}/repos/operator/aligned_layer
147+ target : operator_deposit_into_strategy
148+ params :
149+ CONFIG_FILE=/home/{{ ansible_user }}/config/config-operator.yaml
150+ STRATEGY_ADDRESS={{ lookup('ini', 'weth_strategy_address', file='ini/config-register-operator.ini') }}
151+ AMOUNT=100000000000000000 # 0.1ether
152+ environment :
153+ PATH : " {{ ansible_env.PATH }}:/usr/bin:/usr/local/go/bin"
41154
42155 - name : Allow access to tcp port 9092 from the VPN
156+ become : true
43157 ufw :
44158 rule : allow
45159 port : 9092
46160 proto : tcp
47- src : 100.0.0.0/24
161+ src : 100.0.0.0/24
162+ vars :
163+ ansible_ssh_user : " {{ admin_user }}"
164+
165+ - name : Create systemd services directory
166+ file :
167+ path : " /home/{{ ansible_user }}/.config/systemd/user/"
168+ state : directory
169+
170+ - name : Add service to systemd
171+ template :
172+ src : services/operator.service.j2
173+ dest : " /home/{{ ansible_user }}/.config/systemd/user/operator.service"
174+ force : no
175+
176+ - name : Start Operator service
177+ ansible.builtin.systemd_service :
178+ name : operator
179+ state : started
180+ enabled : true
181+ scope : user
0 commit comments