Giter Club home page Giter Club logo

ansible-nginx's Introduction

install-docker-nginx

Installs nginx as docker systemd service.

System requirements

  • Ubuntu 16.04
  • Systemd
  • Docker

Role requirements

  • python-docker

Tasks

  • Create volume paths for docker container
  • Create configs via templates
  • Setup systemd unit file
  • Start/Restart/Reload service
  • Setup systemd service to reload nginx configuration (default name: nginx.reload.service)
  • Optionally setup systemd service to renew session ticket encryption keys)

Role parameters

Main config

Variable Type Mandatory? Default Description
image_name text no nginx Docker image name
image_version text no 1.13.5-alpine Docker image version
https_port port as number no 443
http_port port as number no 80
conf_folder path as text no /srv/docker/nginx/conf.d
rules_folder path as text no /srv/docker/nginx/rules
certs_folder path as text no /srv/docker/nginx/certs
ssl_folder path as text no /srv/docker/nginx/ssl
www_folder path as text no /srv/docker/nginx/www
log_folder path as text no /var/log/nginx
script_folder path as text no /opt/nginx
clear_dh_parameter boolean no false
dh_parameter_bits integer number no 4096
ticketkey_enabled boolean no no Defines if the ssl_session_ticket_key is persisted on filesystem and not managed by this nginx instance itself
configs site config as embedded object no

mainconfig.config

The site config object is structured as map: the key represents the config name, the value is an embedded object with following structure:

Property Type Mandatory? Default Description
upstreams site upstream as embedded object no defines upstreams
https boolean no false defines if this site is accessible secured via https or not
server_name text yes defines the site server_name
locations array of locations no defines the site locations

siteconfig.upstream

Property Type Mandatory? Default Description
upstream_name text yes the unique name of the corresponding upstream
upstream_url url as text yes

siteconfig.location

Property Type Mandatory? Default Description
location url as text yes like: /service/
proxy_to absolute url as text no like: http://harbor_ui/service/
returns no like: 404
options dictionary (key-value pairs) no Nginx options to be templated in your location config

Example Playbook

Usage (without parameters):

- hosts: servers
  roles:
  - install-docker-nginx

Usage (with parameters):

- hosts: servers
  roles:
  - role: install-docker-nginx
    certs_folder: "/mydrive/letsencrypt/config/live"
    ticketkey_enabled: yes
    configs:
      gitlab:
        https: false
        upstreams:
          gitlab: "172.17.0.1:10080"
        server_name: git.flandigt.de
        locations:
        - location: /
          proxy_to: http://gitlab/
          options:
            client_max_body_size: 8192m
      harbor_ui:
        https: false
        upstreams:
          harbor_ui: "172.17.0.1:50080"
          harbor_registry: "172.17.0.1:55000"
        server_name: harbor.flandigt.de
        locations:
        - location: /
          proxy_to: http://harbor_ui/
        - location: /v1/
          returns: 404
        - location: /v2/
          proxy_to: http://harbor_registry/v2/
        - location: /service/
          proxy_to: http://harbor_ui/service/
        - location: /service/notifications
          returns: 404

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.