nginx/structure.yml

49 lines
1.6 KiB
YAML
Raw Normal View History

2026-02-10 09:42:16 +01:00
%YAML 1.2
---
version: 1.1
2026-02-10 09:54:22 +01:00
nginx:
2026-02-10 09:59:01 +01:00
description: pedagogic html static file server
2026-02-10 10:03:19 +01:00
help: |-
This is a complete Ansible playbook to configure Nginx with basic authentication using htpasswd.
This playbook installs Nginx, configures a static website, and secures access with basic authentication.
2026-02-10 10:08:33 +01:00
2026-02-10 10:03:19 +01:00
steps:
2026-02-10 10:08:33 +01:00
2026-02-10 10:03:19 +01:00
- Installation of Nginx: The playbook installs Nginx and ensures it is started and enabled.
- Creation of the website directory: A directory is created to host the website files.
- Creation of a simple homepage: A simple HTML page is created for the website.
- Installation of apache2-utils: This package is necessary to use the htpasswd command.
- Creation of the htpasswd file: A .htpasswd file is created with a username and password.
- Configuration of the Nginx site: The nginx_site.conf.j2 template is used to configure Nginx with basic authentication.
- Activation of the Nginx site: The site is enabled by creating a symbolic link in the sites-enabled directory.
- Testing the Nginx configuration: The Nginx configuration is tested before restarting the service.
- Restarting Nginx: Nginx is restarted to apply the changes.
2026-02-10 09:42:16 +01:00
domain_name:
2026-02-10 09:48:09 +01:00
description: domain name
examples:
- exemple.fr
2026-02-10 10:08:33 +01:00
type: domainname
2026-02-10 09:42:16 +01:00
htpasswd_file:
description: htpassword file
2026-02-10 10:08:33 +01:00
type: unix_filename
2026-02-10 09:42:16 +01:00
default: /etc/nginx/.htpasswd
email:
2026-02-10 10:18:02 +01:00
description: email for the certbot domain name
2026-02-10 09:54:22 +01:00
examples:
- contact@exemple.fr
2026-02-10 10:08:33 +01:00
type: mail
2026-02-10 09:48:09 +01:00
2026-02-10 09:42:16 +01:00
users:
type: leadership
2026-02-10 09:48:09 +01:00
2026-02-10 09:42:16 +01:00
username:
type: unix_user
2026-02-10 09:48:09 +01:00
2026-02-10 09:42:16 +01:00
password:
type: secret
2026-02-10 10:08:33 +01:00
...