Bootstrap caddy 410 role
This commit is contained in:
commit
1338435aa3
9 changed files with 134 additions and 0 deletions
13
LICENSE
Normal file
13
LICENSE
Normal file
|
@ -0,0 +1,13 @@
|
|||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2019 Wilfried OLLIVIER <wollivier@fdn.fr>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
38
README.md
Normal file
38
README.md
Normal file
|
@ -0,0 +1,38 @@
|
|||
# galaxy-caddy.410
|
||||
|
||||
Push caddy config file returning a 410 status
|
||||
|
||||
## Requirements
|
||||
|
||||
Caddy webserver up and running
|
||||
|
||||
## Role Variables
|
||||
|
||||
- caddy_home: caddy home directory
|
||||
- caddy_logs: caddy log directory
|
||||
- caddy_conf: caddy config directory
|
||||
- caddy_confd: caddy conf.d directory
|
||||
- caddy_www: /var/www/caddy
|
||||
|
||||
- vhost_name: name of the vhost
|
||||
- vhost_url: url of the vhost
|
||||
|
||||
## Dependencies
|
||||
|
||||
- galaxy-caddy
|
||||
|
||||
## Example Playbook
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: ../galaxy-caddy.reverse, vhost_url: https://default.com }
|
||||
|
||||
## Run tests
|
||||
|
||||
Needs galaxy-vagrant to run tests
|
||||
|
||||
Ensure galaxy-vagrant is up
|
||||
|
||||
ansible-playbook -i tests/inventory tests/test.yml
|
10
defaults/main.yml
Normal file
10
defaults/main.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
# defaults file for galaxy-caddy.410
|
||||
|
||||
caddy_home: /opt/caddy
|
||||
caddy_logs: /var/log/caddy
|
||||
caddy_conf: /etc/caddy
|
||||
caddy_confd: /etc/caddy/conf.d
|
||||
caddy_www: /var/www/caddy
|
||||
|
||||
vhost_name: default
|
13
handlers/main.yml
Normal file
13
handlers/main.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
# handlers file for galaxy-caddy.reverse
|
||||
|
||||
- name: start caddy
|
||||
service: name=caddy
|
||||
state=started
|
||||
enabled=yes
|
||||
daemon_reload=yes
|
||||
|
||||
- name: restart caddy
|
||||
service: name=caddy
|
||||
state=restarted
|
||||
enabled=yes
|
21
meta/main.yml
Normal file
21
meta/main.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
galaxy_info:
|
||||
author: Wilfried OLLIVIER
|
||||
description: Push caddy config file returning a 410 status
|
||||
company: none
|
||||
|
||||
license: WTFPL
|
||||
|
||||
min_ansible_version: 2.9
|
||||
|
||||
platforms:
|
||||
- name: Debian
|
||||
versions:
|
||||
- Stretch
|
||||
- Buster
|
||||
|
||||
galaxy_tags:
|
||||
- caddy
|
||||
- webserver
|
||||
- http
|
||||
|
||||
dependencies: []
|
16
tasks/main.yml
Normal file
16
tasks/main.yml
Normal file
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
# tasks file for galaxy-caddy.reverse
|
||||
|
||||
- name: Push caddy template file
|
||||
template:
|
||||
src: 410.caddy.j2
|
||||
dest: "{{ caddy_confd }}/{{ vhost_name }}.caddy"
|
||||
owner: caddy
|
||||
notify: restart caddy
|
||||
|
||||
|
||||
- name: Ensure log dir
|
||||
file:
|
||||
path: "{{ caddy_logs }}/{{ vhost_name }}"
|
||||
state: directory
|
||||
owner: caddy
|
17
templates/410.caddy.j2
Normal file
17
templates/410.caddy.j2
Normal file
|
@ -0,0 +1,17 @@
|
|||
{{ vhost_url }} {
|
||||
|
||||
status 410 /
|
||||
|
||||
log {{ caddy_logs }}/{{ vhost_name }}/access.log {
|
||||
rotate_size 100
|
||||
rotate_age 30
|
||||
rotate_keep 10
|
||||
}
|
||||
|
||||
errors {{ caddy_logs }}/{{ vhost_name }}/errors.log {
|
||||
rotate_size 100
|
||||
rotate_age 30
|
||||
rotate_keep 10
|
||||
}
|
||||
|
||||
}
|
1
tests/inventory
Normal file
1
tests/inventory
Normal file
|
@ -0,0 +1 @@
|
|||
galaxy-vagrant.example.com
|
5
tests/test.yml
Normal file
5
tests/test.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- hosts: galaxy-vagrant.example.com
|
||||
remote_user: root
|
||||
roles:
|
||||
- { role: ../galaxy-caddy.reverse, vhost_url: https://default.com }
|
Loading…
Add table
Reference in a new issue