# Best Practices(?): common tactics for server setups & data storage

**URL:** <https://deeptalk.lambda.ai/t/best-practices-common-tactics-for-server-setups-data-storage/3535>\
**Category:** Deep Learning: Getting Started\
**Created:** [February 19, 2023, 9:00pm UTC](https://deeptalk.lambda.ai/t/best-practices-common-tactics-for-server-setups-data-storage/3535 "2023-02-19T21:00:03Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![yanos](https://avatars.discourse-cdn.com/v4/letter/y/a183cd/32.png) [@yanos](https://deeptalk.lambda.ai/u/yanos)\
**Post date:** [May 24, 2023, 7:43pm UTC](https://deeptalk.lambda.ai/t/best-practices-common-tactics-for-server-setups-data-storage/3535/3 "2023-05-24T19:43:34Z")

</div>

Hello @JimVincent and @comodoro!

Here is a simple way to deploy your software stack on the Lambda Cloud using Ansible.  
eg. create “ready\_to\_work.yml”

```
---
# you can run this as follows:
# ansible-playbook --ssh-common-args='-o StrictHostKeyChecking=no' ready_to_work.yml -i lambda_cloud_instance_ip,
# DON'T FORGET THE , IN THE END!
# eg. ansible-playbook --ssh-common-args='-o StrictHostKeyChecking=no' ready_to_work.yml -i 10.0.0.2,
- hosts: all
remote_user: ubuntu
vars:
    ansible_ssh_private_key_file: "~/.ssh/your-private-ssh-key-for-lambda-instances"
    github_username: put_username_here
    github_token: put_password_here
    github_repo: put_repo_name_here
tasks:
# Here, we use the variables set above
# We clone the repo to the home directory of the user
- name: Checkout Your Code From Github Using Ansible.
    git:
    repo: "https://{{ github_token }}@github.com/{{ github_username }}/{{ github_repo }}.git"
    dest: "~/{{ github_repo }}"

- name: Install apt packages
  ansible.builtin.apt:
    name: "{{ item }}"
    state: present
    update_cache: yes
  loop:
    - package1
    - package2

- name: Install pip packages
  ansible.builtin.pip:
    name: "{{ item }}"
  loop:
    - package1
    - package2

# Or start a Docker container
- name: Start Docker container
docker_container:
    name: mycontainer
    state: present
    image: ubuntu:22.04
    command: sleep infinity

```

You can also create a bash script to check if the Lambda instance has booted (by checking if port 22 is active) and then run the ansible script on it.

Create bash\_script.sh

```auto
until nc -vzw 2 $1 22; do sleep 2; done
ansible-playbook --ssh-common-args='-o StrictHostKeyChecking=no' rready_to_work.yml -i $1,

```

Run it like this:  
`$ bash bash_script.sh <instance_ip>`

Best,  
Yanos

---

_[View the full topic](https://deeptalk.lambda.ai/t/best-practices-common-tactics-for-server-setups-data-storage/3535)._
