40 lines
781 B
Markdown
40 lines
781 B
Markdown
# Ansible playbook to deploy stack for Django
|
|
|
|
## Virtualenv
|
|
|
|
Setup virtualenv locally
|
|
|
|
```
|
|
python3.11 -m venv ./venv
|
|
source ./venv/bin/activate
|
|
pip install --upgrade pip
|
|
```
|
|
|
|
After that setup ansible and all requirements
|
|
|
|
```
|
|
pip install -r ./requirements.txt
|
|
```
|
|
|
|
## Configure remote servers list
|
|
|
|
Edit invetory file `hosts`. Replace domain and IP address at least.
|
|
|
|
## Configure playbook
|
|
|
|
Edit variables in `setup.yaml` to install and configure needed software
|
|
|
|
## Run
|
|
|
|
```
|
|
ansible-playbook -i hosts ./setup.yaml
|
|
```
|
|
|
|
If you don't have authorization via ssh keys you may add `-k` option to ask ssh password.
|
|
If you don't have passwordless sudo access you may add `-K` option to ask sudo password.
|
|
|
|
So, the command will be like
|
|
|
|
```
|
|
ansible-playbook -i hosts ./setup.yaml -kK
|
|
``` |