Giter Site home page Giter Site logo

i39 / ansible-nginx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from william-yeh/ansible-nginx

0.0 1.0 0.0 43 KB

An Ansible role that installs Nginx, in the format for Ansible Galaxy.

Home Page: https://galaxy.ansible.com/williamyeh/nginx/

License: MIT License

Shell 100.00%

ansible-nginx's Introduction

williamyeh.nginx for Ansible Galaxy

Circle CI Build Status

Summary

Role name in Ansible Galaxy: williamyeh.nginx

This Ansible role has the following features for Nginx:

  • Install specific version.
  • Handlers for restart/reload/stop events;
  • Bare bone configuration (real configuration should be left to user's template files; see Usage section below).

Role Variables

Mandatory variables

None.

Optional variables

User-installable configuration files (by Ansible's template system):

# main conf template to be installed to "/etc/nginx/nginx.conf";
# relative to `playbook_dir`
nginx_conf_main


# other conf templates to be installed to "/etc/nginx/conf.d";
# dict fields:
#   - key: memo for this conf
#   - value:
#     - src:  template file relative to `playbook_dir`
#     - dest: target file relative to `/etc/nginx/conf.d/`
nginx_conf_others

User-configurable defaults:

# Nginx version; e.g., "1.8.1"
# Will install the default (usually the latest stable) version, if not specified.
nginx_version


# start the service at the end of the role?
# default: True
nginx_start      


# uid of worker process;
# default: "nginx".
nginx_user


# for worker_rlimit_nofile in nginx.conf
nginx_ulimit:  51200

# for worker_connections in nginx.conf
nginx_worker_connections:  1024


# install health-check endpoint "http://HOST:PORT/nginx_status"?
nginx_status:  False

# use `service` command to start/restart nginx daemon?
nginx_use_service:  True

Handlers

  • restart nginx

  • reload nginx

  • stop nginx

Usage

Step 1: add role

Add role name williamyeh.nginx to your playbook file.

Step 2: add variables

Set vars in your playbook file.

Simple example:

---
# file: simple-playbook.yml

- hosts: all

  roles:
    - williamyeh.nginx

  vars:
    nginx_version: 1.8.1

Step 3: copy user's config files, if necessary

More practical example:

---
# file: complex-playbook.yml

- hosts: all

  roles:
    - williamyeh.nginx

  vars:
    nginx_version: 1.8.1

    nginx_conf_main: "templates/nginx.conf.j2"

    nginx_conf_others:
      conf_template_for_app_1:
        src: "templates/app-1.conf.j2"
        dest: app-1.conf
      conf_template_for_app_2:
        src: "templates/app-2.conf.j2"
        dest: app-2.conf

Dependencies

None.

License

MIT License. See the LICENSE file for details.

History

Rewritten from my pre-Galaxy version: server-config-template.

During refactoring, some roles on Ansible Galaxy also inspired me:

ansible-nginx's People

Contributors

william-yeh avatar

Watchers

 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.