mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-22 12:41:05 +01:00
renamed and optimized homepage role
This commit is contained in:
parent
839b1b433d
commit
7fa215a414
@ -35,11 +35,11 @@
|
|||||||
- client-wireguard
|
- client-wireguard
|
||||||
|
|
||||||
# Native Webserver Roles
|
# Native Webserver Roles
|
||||||
- name: setup homepages
|
- name: setup nginx-homepages
|
||||||
hosts: homepage
|
hosts: nginx-homepage
|
||||||
become: true
|
become: true
|
||||||
roles:
|
roles:
|
||||||
- role: homepage
|
- role: nginx-homepage
|
||||||
vars:
|
vars:
|
||||||
domain: "{{top_domain}}"
|
domain: "{{top_domain}}"
|
||||||
- name: setup redirect hosts
|
- name: setup redirect hosts
|
||||||
|
33
roles/nginx-homepage/Readme.md
Normal file
33
roles/nginx-homepage/Readme.md
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Nginx Homepage Role
|
||||||
|
|
||||||
|
This Ansible role configures an Nginx server to serve a static homepage. It handles domain configuration, SSL certificate retrieval with Let's Encrypt, and cloning the homepage content from a Git repository.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- Ansible 2.9 or higher
|
||||||
|
- Nginx installed on the target machine
|
||||||
|
- Git installed on the target machine (if cloning a repo)
|
||||||
|
- `https-server` and `git` roles available or configured if they are used as dependencies
|
||||||
|
|
||||||
|
## Role Variables
|
||||||
|
|
||||||
|
- `nginx_homepage_root`: The directory where the homepage content will be stored (default: `/usr/share/nginx/homepage`)
|
||||||
|
- `domain`: The domain name for the Nginx server configuration
|
||||||
|
- `administrator_email`: The email used for SSL certificate registration with Let's Encrypt
|
||||||
|
- `nginx_homepage_repository_address`: The Git repository address containing the homepage content
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- `https-server`: A role for setting up an HTTPS server
|
||||||
|
- `git`: A role for installing Git
|
||||||
|
|
||||||
|
## Example Playbook
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- { role: nginx-homepage, domain: 'example.com', administrator_email: 'admin@example.com' }
|
||||||
|
```
|
||||||
|
|
||||||
|
## Author Information
|
||||||
|
This role was created in 2023 by Kevin Veen Birkenbach.
|
@ -5,10 +5,10 @@
|
|||||||
- name: recieve {{domain}} certificate
|
- name: recieve {{domain}} certificate
|
||||||
command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}}
|
command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}}
|
||||||
|
|
||||||
- name: homepage repo git
|
- name: nginx-homepage repo git
|
||||||
git:
|
git:
|
||||||
repo: "{{homepage_repository_address}}"
|
repo: "{{nginx_homepage_repository_address}}"
|
||||||
dest: "/usr/share/nginx/homepage"
|
dest: "{{nginx_homepage_root}}"
|
||||||
update: yes
|
update: yes
|
||||||
register: git_result
|
register: git_result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
1
roles/nginx-homepage/vars/main.yml
Normal file
1
roles/nginx-homepage/vars/main.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
nginx_homepage_root: /usr/share/nginx/homepage
|
Loading…
Reference in New Issue
Block a user