Move remote host setup to root README

This commit is contained in:
Adw8
2024-09-09 14:53:06 +05:30
parent dc6145f37d
commit 852db93b9e
7 changed files with 64 additions and 140 deletions
+8 -37
View File
@@ -4,42 +4,13 @@
To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine
## Setup Remote Hosts
## Setup for Remote Host
To run the playbook on a remote machine, follow these steps:
To run the playbook on a remote host:
- In the [`l2-setup`](./) directory, create a new file named hosts.ini:
- Follow steps from [setup remote hosts](../README.md#setup-remote-hosts)
```bash
cp ../example-hosts.ini hosts.ini
```
- Edit the [`hosts.ini`](./hosts.ini) file to run the playbook on a remote machine
```bash
[nitro_host]
<host_name> ansible_host=<TARGET_IP> ansible_user=<SSH_USER> ansible_ssh_common_args='-o ForwardAgent=yes'
```
- Replace `<host_name>` with the alias of your choice.
- Replace `<TARGET_IP>` with the IP address or hostname of the target machine.
- Replace `<SSH_USER>` with the SSH username (e.g., dev, ubuntu).
- Verify that you are able to connect to the host using the following command
```bash
ansible all -m ping -i hosts.ini -k
# Expected output:
# <host_name> | SUCCESS => {
# "ansible_facts": {
# "discovered_interpreter_python": "/usr/bin/python3.10"
# },
# "changed": false,
# "ping": "pong"
# }
```
- Update / append the [`hosts.ini`](../hosts.ini) file for your remote host with `<deployment_host>` set as `l2_host`
## Setup and Run Optimism
@@ -85,10 +56,10 @@ The following commands have to be executed in [`l2-setup`](./) directory
LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER
```
- For remote deployment, provide an inventory and specify the `"target_host": nitro_host` in the `--extra-vars` parameter:
- For remote deployment, provide an inventory and specify the `"target_host": l2_host` in the `--extra-vars` parameter:
```bash
LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-optimism.yml --extra-vars='{ "target_host": "nitro_host"}' -kK
LANG=en_US.utf8 ansible-playbook -i ../hosts.ini run-optimism.yml --extra-vars='{ "target_host": "l2_host"}' -kK
```
NOTE: By default, deployments are created in a `out` directory. To change this location, update the `l2_directory` variable in the [setup-vars.yml](./setup-vars.yml) file.
@@ -96,7 +67,7 @@ The following commands have to be executed in [`l2-setup`](./) directory
- For skipping container build, set `"skip_container_build" : true` in the `--extra-vars` parameter:
```bash
LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-optimism.yml --extra-vars='{"target_host" : "nitro_host", "skip_container_build": true}' -kK
LANG=en_US.utf8 ansible-playbook -i ../hosts.ini run-optimism.yml --extra-vars='{"target_host" : "l2_host", "skip_container_build": true}' -kK
```
- To run using existing contracts deployment
@@ -106,7 +77,7 @@ The following commands have to be executed in [`l2-setup`](./) directory
- Run the ansible playbook with `"existing_contracts_deployment": true` in the `--extra-vars` parameter:
```bash
LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-optimism.yml --extra-vars='{"target_host" : "nitro_host", "existing_contracts_deployment": true}' -kK
LANG=en_US.utf8 ansible-playbook -i ../hosts.ini run-optimism.yml --extra-vars='{"target_host" : "l2_host", "existing_contracts_deployment": true}' -kK
```
## Check Deployment Status