Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Commit

Permalink
Update geerlingguy.nginx role to latest version (with IPv6 support).
Browse files Browse the repository at this point in the history
  • Loading branch information
geerlingguy committed Apr 14, 2021
1 parent 733000d commit a3aaa45
Show file tree
Hide file tree
Showing 16 changed files with 137 additions and 37 deletions.
2 changes: 1 addition & 1 deletion provisioning/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ roles:
- name: geerlingguy.mysql
version: 3.3.0
- name: geerlingguy.nginx
version: 2.8.0
version: 3.0.0
- name: geerlingguy.nodejs
version: 5.1.1
- name: geerlingguy.php
Expand Down
3 changes: 3 additions & 0 deletions provisioning/roles/geerlingguy.nginx/.ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
skip_list:
- 'yaml'
- 'role-name'
68 changes: 68 additions & 0 deletions provisioning/roles/geerlingguy.nginx/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
name: CI
'on':
pull_request:
push:
branches:
- master
schedule:
- cron: "0 6 * * 3"

defaults:
run:
working-directory: 'geerlingguy.nginx'

jobs:

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
with:
path: 'geerlingguy.nginx'

- name: Set up Python 3.
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install test dependencies.
run: pip3 install yamllint

- name: Lint code.
run: |
yamllint .
molecule:
name: Molecule
runs-on: ubuntu-latest
strategy:
matrix:
distro:
- centos8
- ubuntu2004
- ubuntu1804
- debian10

steps:
- name: Check out the codebase.
uses: actions/checkout@v2
with:
path: 'geerlingguy.nginx'

- name: Set up Python 3.
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install test dependencies.
run: pip3 install ansible molecule[docker] docker

- name: Run Molecule tests.
run: molecule test
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
MOLECULE_DISTRO: ${{ matrix.distro }}
38 changes: 38 additions & 0 deletions provisioning/roles/geerlingguy.nginx/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
# This workflow requires a GALAXY_API_KEY secret present in the GitHub
# repository or organization.
#
# See: https://github.com/marketplace/actions/publish-ansible-role-to-galaxy
# See: https://github.com/ansible/galaxy/issues/46

name: Release
'on':
push:
tags:
- '*'

defaults:
run:
working-directory: 'geerlingguy.nginx'

jobs:

release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
with:
path: 'geerlingguy.nginx'

- name: Set up Python 3.
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install Ansible.
run: pip3 install ansible-base

- name: Trigger a new import on Galaxy.
run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
2 changes: 2 additions & 0 deletions provisioning/roles/geerlingguy.nginx/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.retry
*/__pycache__
*.pyc
.cache

29 changes: 0 additions & 29 deletions provisioning/roles/geerlingguy.nginx/.travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions provisioning/roles/geerlingguy.nginx/.yamllint
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
---
extends: default

rules:
line-length:
max: 120
level: warning

ignore: |
.github/stale.yml
.travis.yml
7 changes: 6 additions & 1 deletion provisioning/roles/geerlingguy.nginx/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ansible Role: Nginx

[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-nginx.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-nginx)
[![CI](https://github.com/geerlingguy/ansible-role-nginx/workflows/CI/badge.svg?event=push)](https://github.com/geerlingguy/ansible-role-nginx/actions?query=workflow%3ACI)

**Note:** Please consider using the official [NGINX Ansible role](https://github.com/nginxinc/ansible-role-nginx) from NGINX, Inc.

Expand All @@ -16,6 +16,11 @@ None.

Available variables are listed below, along with default values (see `defaults/main.yml`):


nginx_listen_ipv6: true

Whether or not to listen on IPv6 (applied to all vhosts managed by this role).

nginx_vhosts: []

A list of vhost definitions (server blocks) for Nginx virtual hosts. Each entry will create a separate config file named by `server_name`. If left empty, you will need to supply your own virtual host configuration. See the commented example in `defaults/main.yml` for available server options. If you have a large number of customizations required for your server definition(s), you're likely better off managing the vhost configuration file yourself, leaving this variable set to `[]`.
Expand Down
4 changes: 4 additions & 0 deletions provisioning/roles/geerlingguy.nginx/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ nginx_extra_http_options: ""
# proxy_set_header Host $http_host;

nginx_remove_default_vhost: false

# Listen on IPv6 (default: true)
nginx_listen_ipv6: true

nginx_vhosts: []
# Example vhost below, showing all available options:
# - listen: "80" # default: "80"
Expand Down
1 change: 0 additions & 1 deletion provisioning/roles/geerlingguy.nginx/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ galaxy_info:
platforms:
- name: EL
versions:
- 6
- 7
- 8
- name: Debian
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ dependency:
name: galaxy
driver:
name: docker
lint: |
set -e
yamllint .
ansible-lint
platforms:
- name: instance
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
file:
path: /var/log/nginx
state: directory
mode: 0755
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
file:
path: /var/log/nginx
state: directory
mode: 0755
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name: dirmngr
state: present

- name: Add PPA for Nginx.
- name: Add PPA for Nginx (if configured).
apt_repository:
repo: 'ppa:nginx/{{ nginx_ppa_version }}'
state: present
Expand Down
1 change: 1 addition & 0 deletions provisioning/roles/geerlingguy.nginx/tasks/vhosts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
file:
path: "{{ nginx_vhost_path }}"
state: directory
mode: 0755
notify: reload nginx

- name: Add managed vhost config files.
Expand Down
6 changes: 6 additions & 0 deletions provisioning/roles/geerlingguy.nginx/templates/vhost.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
{% if item.server_name_redirect is defined %}
server {
listen {{ item.listen | default('80') }};
{% if nginx_listen_ipv6 %}
listen [::]:{{item.listen | default('80') }};
{% endif %}
server_name {{ item.server_name_redirect }};
return 301 $scheme://{{ item.server_name.split(' ')[0] }}$request_uri;
}
Expand All @@ -13,6 +16,9 @@ server {

{% block server_basic -%}
listen {{ item.listen | default('80') }};
{% if nginx_listen_ipv6 %}
listen [::]:{{item.listen | default('80') }};
{% endif %}

{% if item.server_name is defined %}
server_name {{ item.server_name }};
Expand Down

0 comments on commit a3aaa45

Please sign in to comment.