First of all, we'll need to create some configuration templates for the different services used on the server. These will be used by both deployment procedures: staging and production.
- In your Django project, create a deployment directory and inside of it create an ansible_templates directory.
- Create a Jinja template file for time zone configuration:
{# deployment/ansible_templates/timezone.j2 #}{{ timezone }}
- Create a Jinja template file for Nginx domain configuration before setting the SSL certificates:
{# deployment/ansible_templates/nginx-pre.j2 #}server{ listen 80; server_name {{ domain_name }}; location /.well-known/acme-challenge { root /var/www/letsencrypt; try_files $uri $uri/ =404; } location / { root /var/www/letsencrypt; ...