## Put cloned repository to PATH 👣

By putting it in the path, you can use it from anywhere in the terminal.

For bash, you could run something like this:

`echo 'export PATH="$PATH:/path/to/SecDep"' >> ~/.bashrc`

For zsh, you could run something like this:

`echo 'export PATH="$PATH:/path/to/SecDep"' >> ~/.zshrc`

## Make it executable 🪄

`chmod +x /path/to/SecDep/secdep.py`

## Make an alias 🧙

For bash

`echo "alias secdep='python3 /path/to/SecDep/secdep.py'" >> ~/.bashrc`

For zsh

`echo "alias secdep='python3 /path/to/SecDep/secdep.py'" >> ~/.zshrc`

Or if it is in the path:

For bash

`echo "alias secdep='secdep.py'" >> ~/.bashrc`

For zsh

`echo "alias secdep='secdep.py'" >> ~/.zshrc`

## Usage after those steps 📖

We can now use the tool by running `secdep` in the terminal.

For example `secdep -h` will show the help menu.

## Easier ssh command 💪

If the repository is in the path, you can make a zsh or bash function in your .zshrc or .bashrc respectively as:

```bash
function secdepssh {
ssh -i $(whereis secdep) secdep@$1
}
```

Where $1 will be the instance's ip address.

Then it is only a matter of `secdepssh <ip>`

## Specific aws use case

When using aws as provider value, you can use the `--awsregion` flag to specify the region on which we operate. That decreases the speed of some actions because it no longer needs to go through all of the regions to check if there are any nodes there.

Example usage:

`secdep -P aws -l --awsregion us-east-2`

`secdep -P aws -a deleteall --awsregion us-east-2`

## Usage with Ansible 🤖 goes hand in hand<img src="../../../assets/videos/handshake.gif" height="32px"/>

If you have Ansible installed, you can use the hosts file generated by SecDep to run commands on all of the instances simultaneously.
This file is located in the SecDep directory and is being updated every time you create or delete an instance. All instances have a secdep user created and you automatically have an ssh key to use for the connection so you can easily use Ansible to run commands to all of them. If you have Ansible playbooks you wish to run on fresh installations you should create the instances without the `--deploy` flag.

Example usage with ansible from the same directory as the hosts file:

`ansible all -i hosts --private-key=secdep -u secdep -a 'touch ansible.txt'`
