Add instructions to run Ansible playbooks on remote machines #5
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
l2-setup/out
|
l2-setup/out
|
||||||
|
l2-setup/hosts.ini
|
||||||
nitro-bridge-setup/out
|
nitro-bridge-setup/out
|
||||||
nitro-bridge-setup/bridge-vars.yml
|
nitro-bridge-setup/bridge-vars.yml
|
||||||
nitro-nodes-setup/nitro-vars.yml
|
nitro-nodes-setup/nitro-vars.yml
|
||||||
|
2
example-hosts.ini
Normal file
2
example-hosts.ini
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[nitro_host]
|
||||||
|
host_name ansible_host=<TARGET_IP> ansible_user=<SSH_USER> ansible_ssh_common_args='-o ForwardAgent=yes'
|
@ -4,6 +4,33 @@
|
|||||||
|
|
||||||
To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine
|
To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine
|
||||||
|
|
||||||
|
## Setup Remote Hosts
|
||||||
|
|
||||||
|
To run the playbooks on a remote machine, follow these steps:
|
||||||
|
|
||||||
|
- In the [`l2-setup`](./) directory, create a new file named hosts.ini:
|
||||||
|
|
||||||
|
```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]
|
||||||
|
hostname ansible_host= ansible_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
|
||||||
|
```
|
||||||
|
|
||||||
## Setup and Run Optimism
|
## Setup and Run Optimism
|
||||||
|
|
||||||
The following commands have to be executed in [`l2-setup`](./) directory
|
The following commands have to be executed in [`l2-setup`](./) directory
|
||||||
@ -34,18 +61,26 @@ The following commands have to be executed in [`l2-setup`](./) directory
|
|||||||
l1_priv_key: ""
|
l1_priv_key: ""
|
||||||
```
|
```
|
||||||
|
|
||||||
- To setup and run L2, execute the `run-optimism.yml` Ansible playbook by running the following command.
|
- To setup and run L2, execute the `run-optimism.yml` Ansible playbook by running one of the following commands:
|
||||||
|
|
||||||
NOTE: By default, deployments are created in the `l2-setup/out` directory. To change this location, update the `l2_directory` variable in the [setup-vars.yml](./setup-vars.yml) file.
|
For local deployment:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER
|
LANG=en_US.utf8 ansible-playbook run-optimism.yml --extra-vars='{ "target_host": "localhost"}' -kK --user $USER
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For remote deployment:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-optimism.yml --extra-vars='{ "target_host": "nitro_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.
|
||||||
|
|
||||||
- For skipping container build, set `"skip_container_build" : true` in the `--extra-vars` parameter:
|
- For skipping container build, set `"skip_container_build" : true` in the `--extra-vars` parameter:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK --user $USER
|
LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-optimism.yml --extra-vars='{"target_host" : "nitro_host", "skip_container_build": true}' -kK
|
||||||
```
|
```
|
||||||
|
|
||||||
- To run using existing contracts deployment
|
- To run using existing contracts deployment
|
||||||
@ -55,7 +90,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:
|
- Run the ansible playbook with `"existing_contracts_deployment": true` in the `--extra-vars` parameter:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{"target_host" : "localhost", "existing_contracts_deployment": true}' -kK --user $USER
|
LANG=en_US.utf8 ansible-playbook -i ./hosts.ini run-optimism.yml --extra-vars='{"target_host" : "nitro_host", "existing_contracts_deployment": true}' -kK
|
||||||
```
|
```
|
||||||
|
|
||||||
## Check Deployment Status
|
## Check Deployment Status
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
skip_container_build: false
|
skip_container_build: false
|
||||||
l2_directory: "./out"
|
l2_directory: "out"
|
||||||
existing_contracts_deployment: false
|
existing_contracts_deployment: false
|
||||||
artifact_path: ""
|
artifact_path: ""
|
||||||
|
Loading…
Reference in New Issue
Block a user