remove!(static_websites): unused
This commit is contained in:
parent
86e585eb10
commit
e72f4b0ca3
6 changed files with 0 additions and 304 deletions
|
@ -1,26 +0,0 @@
|
||||||
---
|
|
||||||
# Infrastructure
|
|
||||||
# Ansible instructions to deploy the infrastructure
|
|
||||||
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
|
|
||||||
# Copyright (C) 2020 Saibotk
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, version 3 of the License.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
- name: Install & configure static websites
|
|
||||||
hosts: static_websites
|
|
||||||
serial: 1
|
|
||||||
roles:
|
|
||||||
- docker
|
|
||||||
- docker_cleanup
|
|
||||||
- traefik
|
|
||||||
- static_websites
|
|
|
@ -1,57 +0,0 @@
|
||||||
static_websites
|
|
||||||
===============
|
|
||||||
|
|
||||||
This role provides the ability to deploy various static sites with out docker containers in a very easy way.
|
|
||||||
|
|
||||||
Requirements
|
|
||||||
------------
|
|
||||||
|
|
||||||
You will need to have docker, docker-compose and traefik installed or declared as dependencies with their respective roles.
|
|
||||||
|
|
||||||
**This role assumes that you have setup traefik with an endpoint called `websecure`.**
|
|
||||||
|
|
||||||
Role Variables
|
|
||||||
--------------
|
|
||||||
|
|
||||||
**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.**
|
|
||||||
|
|
||||||
**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!**
|
|
||||||
|
|
||||||
### Global variables, that are used:
|
|
||||||
|
|
||||||
- `proxy_network`: Defined by the local traefik installation, this is the shared proxy network used by traefik to reach the containers. (optional)
|
|
||||||
- `proxy_hiddenservice`: Defined by the local traefik installation, this is used to generate the alt-svc header for the alternative Tor domain. (optional)
|
|
||||||
|
|
||||||
|
|
||||||
### Example config:
|
|
||||||
```yaml
|
|
||||||
---
|
|
||||||
static_websites:
|
|
||||||
example:
|
|
||||||
image: docker.io/acme/example-site # docker image, can include a tag
|
|
||||||
domain: example.com # domain that is published by traefik
|
|
||||||
certresolver: letsencrypt_cf # specify traefik cert resolver (optional)
|
|
||||||
www: true # Add www. as alias (optional)
|
|
||||||
hsts: # HSTS advanced settings (optinal)
|
|
||||||
preloaded: true # enable preloaded header
|
|
||||||
subdomains: true # enable all subdomains header
|
|
||||||
nginx:
|
|
||||||
readonly: true
|
|
||||||
tmpfs:
|
|
||||||
"/tmp/nginx-cache": 1M
|
|
||||||
example2:
|
|
||||||
image: docker.io/acme/example-docs
|
|
||||||
domain: docs.example.com
|
|
||||||
```
|
|
||||||
|
|
||||||
Dependencies
|
|
||||||
------------
|
|
||||||
|
|
||||||
- docker
|
|
||||||
- docker-compose
|
|
||||||
- traefik
|
|
||||||
|
|
||||||
License
|
|
||||||
-------
|
|
||||||
|
|
||||||
GPL-3.0-only
|
|
|
@ -1,42 +0,0 @@
|
||||||
---
|
|
||||||
# Default variables for the static_websites role
|
|
||||||
|
|
||||||
# Infrastructure
|
|
||||||
# Ansible instructions to deploy the infrastructure
|
|
||||||
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
|
|
||||||
# Copyright (C) 2020 Saibotk
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, version 3 of the License.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# The install location (where to put the docker-compose.yml)
|
|
||||||
static_websites_install_location: /srv/static_websites
|
|
||||||
|
|
||||||
# The default certresolver to use by traefik for the domain if none is specified
|
|
||||||
static_websites_default_traefik_certresolver: letsencrypt_http
|
|
||||||
|
|
||||||
# List of all static websites that should be deployed
|
|
||||||
# Available fields:
|
|
||||||
# WEBSITENAME: - The name of the website/entry
|
|
||||||
# image - docker image, can include a tag
|
|
||||||
# domain - domain that is published by traefik
|
|
||||||
# certresolver - specify traefik cert resolver (optional)
|
|
||||||
# www - should we add www. as alias (optional)
|
|
||||||
# hsts: - HSTS advanced settings (optional)
|
|
||||||
# preloaded - enable preloaded header
|
|
||||||
# subdomains - enable all subdomains header
|
|
||||||
# nginx: - nginx specific settings
|
|
||||||
# readonly - specify if the image can be readonly (optional, if this is not defined, tmpfs below is also ignored)
|
|
||||||
# tmpfs: - List tmpfs definitions like the example below that should be added to the container (optional)
|
|
||||||
# "/tmp/nginx-cache": 1M
|
|
||||||
# See the README for an example
|
|
||||||
static_websites: {} # noqa var-naming[no-role-prefix]
|
|
|
@ -1,44 +0,0 @@
|
||||||
galaxy_info:
|
|
||||||
author: saibotk
|
|
||||||
description: "Deploys static website containers with traefik."
|
|
||||||
license: GPL-3.0-only
|
|
||||||
min_ansible_version: "2.9"
|
|
||||||
standalone: true
|
|
||||||
|
|
||||||
platforms:
|
|
||||||
- name: EL
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: GenericUNIX
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: Fedora
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: opensuse
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: GenericBSD
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: FreeBSD
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: Ubuntu
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: SLES
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: GenericLinux
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
- name: Debian
|
|
||||||
versions:
|
|
||||||
- all
|
|
||||||
|
|
||||||
galaxy_tags: []
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
- role: docker
|
|
||||||
- role: traefik
|
|
|
@ -1,58 +0,0 @@
|
||||||
---
|
|
||||||
# Tasks file for the static_websites role
|
|
||||||
|
|
||||||
# Infrastructure
|
|
||||||
# Ansible instructions to deploy the infrastructure
|
|
||||||
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, version 3 of the License.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
- name: Create directory
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ item }}"
|
|
||||||
state: directory
|
|
||||||
mode: "0700"
|
|
||||||
owner: "root"
|
|
||||||
group: "root"
|
|
||||||
with_items:
|
|
||||||
- "{{ static_websites_install_location }}"
|
|
||||||
become: true
|
|
||||||
tags:
|
|
||||||
- deploy_sites
|
|
||||||
|
|
||||||
- name: Deploy docker-compose.yml
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: docker-compose.yml
|
|
||||||
dest: "{{ static_websites_install_location }}/docker-compose.yml"
|
|
||||||
mode: "0600"
|
|
||||||
owner: "root"
|
|
||||||
group: "root"
|
|
||||||
validate: docker compose -f %s config -q
|
|
||||||
when:
|
|
||||||
- static_websites | length > 0
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- deploy_sites
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Compose static websites
|
|
||||||
community.docker.docker_compose_v2:
|
|
||||||
state: present
|
|
||||||
project_src: "{{ static_websites_install_location }}"
|
|
||||||
pull: always
|
|
||||||
remove_orphans: true
|
|
||||||
become: true
|
|
||||||
when:
|
|
||||||
- static_websites | length > 0
|
|
||||||
tags:
|
|
||||||
- deploy_sites
|
|
|
@ -1,77 +0,0 @@
|
||||||
{{ ansible_managed | comment }}
|
|
||||||
|
|
||||||
# Infrastructure
|
|
||||||
# Ansible instructions to deploy the infrastructure
|
|
||||||
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
|
|
||||||
# Copyright (C) 2020 Saibotk
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, version 3 of the License.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
version: '2'
|
|
||||||
services:
|
|
||||||
{% for key, value in static_websites.items() %}
|
|
||||||
|
|
||||||
{{ key }}:
|
|
||||||
image: "{{ value.image }}"
|
|
||||||
mem_limit: 10mb
|
|
||||||
memswap_limit: 15mb
|
|
||||||
{% if value.nginx.readonly is defined and value.nginx.readonly %}
|
|
||||||
read_only: true
|
|
||||||
tmpfs:
|
|
||||||
- /run/:size=32K
|
|
||||||
- /var/cache/nginx:size=10M
|
|
||||||
- /tmp/:size=1M
|
|
||||||
{% if value.nginx.tmpfs is defined %}
|
|
||||||
{% for tmpfs, tmpsize in value.nginx.tmpfs.items() %}
|
|
||||||
- {{ tmpfs }}:size={{ tmpsize }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
security_opt:
|
|
||||||
- no-new-privileges
|
|
||||||
labels:
|
|
||||||
- "traefik.http.routers.static_websites_{{ key }}.rule=Host(`{{ value.domain }}`{% if value.www is defined and value.www %},`www.{{ value.domain }}`{% endif %}) && PathPrefix(`/`)"
|
|
||||||
- "traefik.http.routers.static_websites_{{ key }}.entrypoints=websecure"
|
|
||||||
- "traefik.http.routers.static_websites_{{ key }}.tls=true"
|
|
||||||
- "traefik.http.routers.static_websites_{{ key }}.tls.certresolver={{ value.certresolver | default(static_websites_default_traefik_certresolver) }}"
|
|
||||||
- "traefik.http.routers.static_websites_{{ key }}.middlewares=static_websites_{{ key }},compress"
|
|
||||||
- "traefik.http.middlewares.static_websites_{{ key }}.headers.sslredirect=true"
|
|
||||||
- "traefik.http.middlewares.static_websites_{{ key }}.headers.stsSeconds=63072000"
|
|
||||||
- "traefik.http.middlewares.static_websites_{{ key }}.headers.referrerPolicy=no-referrer"
|
|
||||||
- "traefik.http.middlewares.static_websites_{{ key }}.headers.contentTypeNosniff=true"
|
|
||||||
- "traefik.http.middlewares.static_websites_{{ key }}.headers.browserXssFilter=true"
|
|
||||||
|
|
||||||
- "traefik.enable=true"
|
|
||||||
{% if value.hsts is defined %}
|
|
||||||
- "traefik.http.middlewares.static_websites_{{ key }}.headers.stsPreload={{ value.hsts.preloaded | default("false") }}"
|
|
||||||
- "traefik.http.middlewares.static_websites_{{ key }}.headers.stsIncludeSubdomains={{ value.hsts.subdomains | default("false") }}"
|
|
||||||
{% endif %}
|
|
||||||
{% if proxy_hiddenservice is defined and proxy_hiddenservice.content is defined %}
|
|
||||||
- "traefik.http.middlewares.static_websites_{{ key }}.headers.customresponseheaders.alt-svc=h2={{ proxy_hiddenservice['content'] | b64decode | trim }}:443; ma=2592000"
|
|
||||||
{% endif %}
|
|
||||||
{% if proxy_network is defined %}
|
|
||||||
- "traefik.docker.network={{ proxy_network }}"
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
restart: always
|
|
||||||
{% if proxy_network is defined %}
|
|
||||||
networks:
|
|
||||||
{{ proxy_network }}:
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% if proxy_network is defined %}
|
|
||||||
networks:
|
|
||||||
{{ proxy_network }}:
|
|
||||||
external: true
|
|
||||||
{% endif %}
|
|
Loading…
Add table
Reference in a new issue