Update ansible commands to not prompt for password

This commit is contained in:
Adw8 2024-10-23 10:55:15 +05:30
parent 26632f88d7
commit ea2bf1a7b2
6 changed files with 68 additions and 57 deletions

View File

@ -36,18 +36,19 @@
- Reference: <https://udhayakumarc.medium.com/error-ansible-requires-the-locale-encoding-to-be-utf-8-detected-iso8859-1-6da808387f7d>
- Verify ansible installation by running the following command:
```bash
ansible --version
# ansible [core 2.17.2]
```
- Install `sshpass` used for automating SSH password authentication
```bash
sudo apt-get install sshpass
```
- Install `passlib` used for handling encrypted passwords
```bash
pip install passlib
```
## Playbooks
- [stack-orchestrator-setup](./stack-orchestrator-setup/README.md)

View File

@ -4,7 +4,7 @@
- Setup Ansible: To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine.
- Setup user: Follow steps from [Setup a user](../user-setup/README.md#setup-a-user) to setup a new user with passwordless sudo
- Setup user with passwordless sudo: Follow steps from [Setup a user](../user-setup/README.md#setup-a-user) to setup a new user
## Setup
@ -58,12 +58,12 @@ The following commands have to be executed in the [`nitro-bridge-setup`](./) dir
- Replace `<deployment_host>` with `nitro_host`
- 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)
- Replace `<ssh_user>` with the username of the user that you set up on target machine (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
ansible all -m ping -i hosts.ini
# Expected output:
@ -79,7 +79,7 @@ The following commands have to be executed in the [`nitro-bridge-setup`](./) dir
- Execute the `run-nitro-bridge.yml` Ansible playbook for deploying nitro bridge:
```bash
LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-bridge.yml --extra-vars='{ "target_host": "nitro_host"}' --user $USER -kK
LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-bridge.yml --extra-vars='{ "target_host": "nitro_host"}' --user $USER
```
NOTE: By default, deployments are created in an `out` directory. To change this location, update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file
@ -87,14 +87,14 @@ The following commands have to be executed in the [`nitro-bridge-setup`](./) dir
- For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter:
```bash
LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-bridge.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER -kK
LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-bridge.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER
```
## Check Deployment Status
- Run the following command in the directory where the bridge-deployment is created:
Run the following command in the directory where the bridge-deployment is created:
- Check logs for deployments:
- Check logs for deployments:
```bash
# Check the bridge deployment logs, ensure that the node is running

View File

@ -4,7 +4,7 @@
- Setup Ansible: To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine.
- Setup user: Follow steps from [Setup a user](../user-setup/README.md#setup-a-user) to setup a new user with passwordless sudo
- Setup user with passwordless sudo: Follow steps from [Setup a user](../user-setup/README.md#setup-a-user) to setup a new user with passwordless sudo
## Setup
@ -52,12 +52,12 @@ The following commands have to be executed in the [`nitro-contracts-setup`](./)
- Replace `<deployment_host>` with `nitro_host`
- 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)
- Replace `<ssh_user>` with the username of the user that you set up on target machine (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
ansible all -m ping -i hosts.ini
# Expected output:
@ -73,7 +73,7 @@ The following commands have to be executed in the [`nitro-contracts-setup`](./)
- Execute the `deploy-contracts.yml` Ansible playbook to deploy nitro contracts:
```bash
LANG=en_US.utf8 ansible-playbook -i hosts.ini deploy-contracts.yml --extra-vars='{ "target_host": "nitro_host"}' --user $USER -kK
LANG=en_US.utf8 ansible-playbook -i hosts.ini deploy-contracts.yml --extra-vars='{ "target_host": "nitro_host"}' --user $USER
```
NOTE: By default, deployments are created in an `out` directory. To change this location, update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file
@ -81,14 +81,14 @@ The following commands have to be executed in the [`nitro-contracts-setup`](./)
- For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter:
```bash
LANG=en_US.utf8 ansible-playbook -i hosts.ini deploy-contracts.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER -kK
LANG=en_US.utf8 ansible-playbook -i hosts.ini deploy-contracts.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER
```
## Check Deployment Status
- Run the following command in the directory where the nitro-contracts-deployment is created:
Run the following command in the directory where the nitro-contracts-deployment is created:
- Check logs for deployments:
- Check logs for deployments:
```bash
# Check the L2 nitro contract deployment logs
@ -97,9 +97,9 @@ The following commands have to be executed in the [`nitro-contracts-setup`](./)
## Get Contract Addresses
- Run the following commands in the directory where the deployments are created:
Run the following commands in the directory where the deployments are created:
- Get addresses of L1 nitro contracts:
- Get addresses of L1 nitro contracts:
```bash
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "cat /app/deployment/nitro-addresses.json"

View File

@ -4,7 +4,7 @@
- Setup Ansible: To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine.
- Setup user: Follow steps from [Setup a user](../user-setup/README.md#setup-a-user) to setup a new user with passwordless sudo
- Setup user with passwordless sudo: Follow steps from [Setup a user](../user-setup/README.md#setup-a-user) to setup a new user with passwordless sudo
## Setup
@ -70,12 +70,12 @@ The following commands have to be executed in [`nitro-nodes-setup`](./) director
- Replace `<deployment_host>` with `nitro_host`
- 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)
- Replace `<ssh_user>` with the username of the user that you set up on target machine (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
ansible all -m ping -i hosts.ini
# Expected output:
@ -93,7 +93,7 @@ The following commands have to be executed in [`nitro-nodes-setup`](./) director
- Execute the `run-nitro-nodes.yml` Ansible playbook to deploy nitro nodes:
```bash
LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-nodes.yml --extra-vars='{ "target_host": "nitro_host"}' --user $USER -kK
LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-nodes.yml --extra-vars='{ "target_host": "nitro_host"}' --user $USER
```
NOTE: By default, deployments are created in a `out` directory. To change this location, update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file
@ -101,21 +101,20 @@ The following commands have to be executed in [`nitro-nodes-setup`](./) director
- For skipping container build, run with `"skip_container_build" : true` in the `--extra-vars` parameter:
```bash
LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-nodes.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER -kK
LANG=en_US.utf8 ansible-playbook -i hosts.ini run-nitro-nodes.yml --extra-vars='{ "target_host": "nitro_host", "skip_container_build": true }' --user $USER
```
## Check Deployment Status
- Run the following command in the directory where the deployments are created
Run the following command in the directory where the deployments are created
- Check L1 nitro node logs:
- Check L1 nitro node logs:
```bash
laconic-so deployment --dir l1-nitro-deployment logs nitro-node -f
```
- Check L2 nitro node logs:
- Check L2 nitro node logs:
```bash
laconic-so deployment --dir l2-nitro-deployment logs nitro-node -f

View File

@ -4,7 +4,7 @@
- Setup Ansible: To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine.
- Setup user: Follow steps from [Setup a user](../user-setup/README.md#setup-a-user) to setup a new user with passwordless sudo
- Setup user with passwordless sudo: Follow steps from [Setup a user](../user-setup/README.md#setup-a-user) to setup a new user with passwordless sudo
## Setup Stack Orchestrator
@ -27,12 +27,12 @@ Run the following commands in the [`stack-orchestrator-setup`](./) directory.
- 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)
- Replace `<ssh_user>` with the username of the user that you set up on target machine (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
ansible all -m ping -i hosts.ini
# Expected output:
@ -48,19 +48,21 @@ Run the following commands in the [`stack-orchestrator-setup`](./) directory.
- Execute the `setup-laconic-so.yml` Ansible playbook for setting up stack orchestrator and docker on the target machine:
```bash
LANG=en_US.utf8 ansible-playbook setup-laconic-so.yml -i hosts.ini --extra-vars='{ "target_host": "deployment_host"}' --user $USER -kK
LANG=en_US.utf8 ansible-playbook setup-laconic-so.yml -i hosts.ini --extra-vars='{ "target_host": "deployment_host"}' --user $USER
```
## Verify Installation
- After the installation is complete, verify if `$HOME/bin` is already included in your PATH by running:
Run the following commands on your target machine:
- After the installation is complete, verify if `$HOME/bin` is already included in the `PATH` by running:
```bash
echo $PATH | grep -q "$HOME/bin" && echo "$HOME/bin is already in PATH" || echo "$HOME/bin is not in PATH"
```
If the command outputs `"$HOME/bin is not in PATH"`, you'll need to add it to your `PATH`.
- To add `$HOME/bin` to your PATH, run the following command:
- To add `$HOME/bin` to your `PATH`, run the following command:
```bash
export PATH="$HOME/bin:$PATH"

View File

@ -1,14 +1,23 @@
# user-setup
## Setup Ansible
## Prerequisites
To get started, follow the [installation](../README.md#installation) guide to setup ansible on your machine.
- Setup Ansible: follow the [installation](../README.md#installation) guide to setup ansible on your machine.
- Setup a remote machine with passwordless SSH login for the root user
- Install `passlib` used for handling encrypted passwords when setting up a user
```bash
pip install passlib
```
## Setup a user
- Create a new `hosts.ini` file:
```bash
cd user-setup/
cp ../hosts.example.ini hosts.ini
```