GithubHelp home page GithubHelp logo

anarchotechnyc / ansible-role-lighttpd Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 25 KB

:computer::globe_with_meridians: Install a Lighttpd Web server on a computer with minimal resources.

lighttpd ansible-role

ansible-role-lighttpd's Introduction

Anarcho-Tech NYC: Lighttpd Build Status

An Ansible role for installing a Lighttpd server. Notably, this role has been tested with Raspbian on Raspberry Pi hardware. This role's purpose is to make it simple to install and run a Web server with minimal resources.

Role variables

To configure Lighttpd for a simple use case, several convenience variables are supplied:

Advanced Lighttpd configuration

This role features a relatively thorough Jinja template implementation of the Lighttpd configuration file format syntax. This means you can configure Lighttpd using the lighttpd_config list, whose items are dictionaries (two-dimensional associative arrays) that map nearly one-to-one to the Lighttpd module names and their keys. This implementation supports arbitrarily deeply nested conditionals, Lighttpd arrays, and simple variables.

The most complex part of the implementation is conditionals, which use the keyword conditional as the Lighttpd option list item name. The item itself is a list of dictionaries, each with the following required keys:

  • field
  • operator
  • value
  • options

All of these except options are described on the Lighttpd documentation for conditional configuration. The options item is itself a list of Lighttpd options that are to be applied if the conditional is matched. This list can include another conditional.

Note that Lighttpd is strict with regard to quote style. It exclusively uses double quotes, not single quotes. This means you should be careful to use proper quoting when defining the lighttpd_config list in your vars files.

Examples should help make this clear:

  1. Simple server bound to the alternate HTTP port, 8080.
    lighttpd_config:
      - server:
          port: 8080
      - server:
          document-root: "{{ lighttpd_server_home_dir }}/html"
    The above is equivalent to the Lighttpd configuration file:
    server.port = 8080
    server.document-root: "/var/www/html"
    
  2. Simple virtual host configuration with the default document root different from a domain-specific document root:
    lighttpd_config:
      - server:
          document-root: "{{ lighttpd_server_home_dir }}/html"
      - conditional:
        - field: '$HTTP["host"]'
          operator: '=~'
          value: '(^|\.)example\.com$' # Single quotes to protect `\.`, which is a Jinja2 escape sequence.
          options:
            - server:
                document-root: "{{ lighttpd_server_home_dir }}/example.com"
    The above is equivalent to the Lighttpd configuration file:
    server.document-root = "/var/www/html"
    $HTTP["host"] =~ "(^|\.)example\.com$" {
        server.document-root = "/var/www/html/example.com"
    }
    

See the defaults/main.yaml file for a more thorough example.

ansible-role-lighttpd's People

Contributors

fabacab avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.