From d8c9f1460835d45844978731d40d5347ea0d104e Mon Sep 17 00:00:00 2001 From: Adw8 Date: Wed, 23 Oct 2024 10:55:15 +0530 Subject: [PATCH] Update ansible commands to not prompt for password --- README.md | 13 +++++++------ nitro-bridge-setup/README.md | 28 ++++++++++++++-------------- nitro-contracts-setup/README.md | 28 ++++++++++++++-------------- nitro-nodes-setup/README.md | 29 ++++++++++++++--------------- service-provider-setup/README.md | 6 +++--- stack-orchestrator-setup/README.md | 14 ++++++++------ user-setup/README.md | 13 +++++++++++-- 7 files changed, 71 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index 91572e3..d0c7ed1 100644 --- a/README.md +++ b/README.md @@ -36,18 +36,19 @@ - Reference: +- 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) diff --git a/nitro-bridge-setup/README.md b/nitro-bridge-setup/README.md index 092dd4d..a6d26f0 100644 --- a/nitro-bridge-setup/README.md +++ b/nitro-bridge-setup/README.md @@ -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 `` with `nitro_host` - Replace `` with the alias of your choice - Replace `` with the IP address or hostname of the target machine - - Replace `` with the SSH username (e.g., dev, ubuntu) + - Replace `` 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 + ``` diff --git a/nitro-contracts-setup/README.md b/nitro-contracts-setup/README.md index 7a8fd8e..846af3f 100644 --- a/nitro-contracts-setup/README.md +++ b/nitro-contracts-setup/README.md @@ -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 `` with `nitro_host` - Replace `` with the alias of your choice - Replace `` with the IP address or hostname of the target machine - - Replace `` with the SSH username (e.g., dev, ubuntu) + - Replace `` 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" + ``` diff --git a/nitro-nodes-setup/README.md b/nitro-nodes-setup/README.md index c636aae..5e17f1d 100644 --- a/nitro-nodes-setup/README.md +++ b/nitro-nodes-setup/README.md @@ -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 `` with `nitro_host` - Replace `` with the alias of your choice - Replace `` with the IP address or hostname of the target machine - - Replace `` with the SSH username (e.g., dev, ubuntu) + - Replace `` 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 + ``` diff --git a/service-provider-setup/README.md b/service-provider-setup/README.md index a3071d1..f16fd13 100644 --- a/service-provider-setup/README.md +++ b/service-provider-setup/README.md @@ -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: - - \ No newline at end of file + - diff --git a/stack-orchestrator-setup/README.md b/stack-orchestrator-setup/README.md index 24b0afb..6789e98 100644 --- a/stack-orchestrator-setup/README.md +++ b/stack-orchestrator-setup/README.md @@ -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 `` with the alias of your choice - Replace `` with the IP address or hostname of the target machine - - Replace `` with the SSH username (e.g., dev, ubuntu) + - Replace `` 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" diff --git a/user-setup/README.md b/user-setup/README.md index 5a7e964..3954c81 100644 --- a/user-setup/README.md +++ b/user-setup/README.md @@ -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 ```