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 d8c9f14608
7 changed files with 71 additions and 60 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
@ -44,9 +44,9 @@ The following commands have to be executed in the [`nitro-bridge-setup`](./) dir
- Create a new `hosts.ini` file:
```bash
cp ../hosts.example.ini hosts.ini
```
```bash
cp ../hosts.example.ini hosts.ini
```
- Edit the [`hosts.ini`](./hosts.ini) file:
@ -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,16 +87,16 @@ 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
laconic-so deployment --dir bridge-deployment logs nitro-bridge -f
```
```bash
# Check the bridge deployment logs, ensure that the node is running
laconic-so deployment --dir bridge-deployment logs nitro-bridge -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
@ -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,26 +81,26 @@ 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
```bash
# Check the L2 nitro contract deployment logs
laconic-so deployment --dir nitro-contracts-deployment logs l2-nitro-contracts -f
laconic-so deployment --dir nitro-contracts-deployment logs l2-nitro-contracts -f
```
## 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"
```
```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,22 +101,21 @@ 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
```
```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
```
```bash
laconic-so deployment --dir l2-nitro-deployment logs nitro-node -f
```

View File

@ -62,7 +62,7 @@
memory_limit: "8G" # maximum amount of memory in GB to be used, eg: 8G
deployer_gpg_passphrase: "" # passphrase for creating GPG key used by webapp-deployer, eg: SECRET
handle_auction_requests: "true" # whether the webapp deployer should handle deployment auction requests, eg: true
auction_bid_amount: "100000" # bid amount for deployment auctions in alnt, eg: 500000
auction_bid_amount: "100000" # bid amount for deployment auctions in alnt, eg: 100000
```
- Create a new `hosts.ini` file:
@ -121,7 +121,7 @@ After the playbook finishes executing, the following services will be deployed (
## Cleanup
Follow the steps given below to stop the webapp-deployer, container-registry, fixturenet-laconicd and laconic-console-deployment, undeploy k8s, remove GPG keys and DNS records
Run the following steps on the target machine to stop the webapp-deployer, container-registry, fixturenet-laconicd and laconic-console-deployment, undeploy k8s, remove GPG keys and DNS records
- Stop deployments
```
@ -196,4 +196,4 @@ Follow the steps given below to stop the webapp-deployer, container-registry, fi
```
- Remove DNS records using DigitalOcean's API:
- <https://docs.digitalocean.com/reference/api/api-try-it-now/#/Domain%20Records/domains_delete_record>
- <https://docs.digitalocean.com/reference/api/api-try-it-now/#/Domain%20Records/domains_delete_record>

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
```