Add NGINX Plus tests (#318)
This commit is contained in:
parent
95fe871e69
commit
856a9c93bf
@ -65,6 +65,7 @@ before_install:
|
||||
install:
|
||||
- pip install ansible==2.9.13
|
||||
- pip install ansible-lint==4.3.4
|
||||
- pip install yamllint==1.24.2
|
||||
- pip install molecule==3.0.8
|
||||
- pip install docker==4.3.1
|
||||
script:
|
||||
|
30
README.md
30
README.md
@ -162,29 +162,29 @@ Role Variables
|
||||
|
||||
This role has multiple variables. The descriptions and defaults for all these variables can be found in the **`defaults/main`** directory in the following files:
|
||||
|
||||
- **[defaults/main/main.yml](https://github.com/nginxinc/ansible-role-nginx/blob/master/defaults/main/main.yml):** NGINX installation variables
|
||||
- **[defaults/main/amplify.yml](https://github.com/nginxinc/ansible-role-nginx/blob/master/defaults/main/amplify.yml):** NGINX Amplify agent installation variables
|
||||
- **[defaults/main/template.yml](https://github.com/nginxinc/ansible-role-nginx/blob/master/defaults/main/template.yml):** NGINX configuration templating variables
|
||||
- **[defaults/main/upload.yml](https://github.com/nginxinc/ansible-role-nginx/blob/master/defaults/main/upload.yml):** NGINX configuration/HTML/SSL upload variables
|
||||
- **[defaults/main/linux.yml](https://github.com/nginxinc/ansible-role-nginx/blob/master/defaults/main/linux.yml):** Linux installation variables
|
||||
- **[defaults/main/bsd.yml](https://github.com/nginxinc/ansible-role-nginx/blob/master/defaults/main/bsd.yml):** BSD installation variables
|
||||
- **[defaults/main/unit.yml](https://github.com/nginxinc/ansible-role-nginx/blob/master/defaults/main/unit.yml):** NGINX Unit installation variables
|
||||
- **[defaults/main/main.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/defaults/main/main.yml):** NGINX installation variables
|
||||
- **[defaults/main/amplify.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/defaults/main/amplify.yml):** NGINX Amplify agent installation variables
|
||||
- **[defaults/main/template.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/defaults/main/template.yml):** NGINX configuration templating variables
|
||||
- **[defaults/main/upload.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/defaults/main/upload.yml):** NGINX configuration/HTML/SSL upload variables
|
||||
- **[defaults/main/linux.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/defaults/main/linux.yml):** Linux installation variables
|
||||
- **[defaults/main/bsd.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/defaults/main/bsd.yml):** BSD installation variables
|
||||
- **[defaults/main/unit.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/defaults/main/unit.yml):** NGINX Unit installation variables
|
||||
|
||||
Similarly, descriptions and defaults for preset variables can be found in the **`vars`** directory:
|
||||
|
||||
- **[vars/main.yml](https://github.com/nginxinc/ansible-role-nginx/blob/master/vars/main.yml):** NGINX supported modules
|
||||
- **[vars/main.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/vars/main.yml):** NGINX supported modules
|
||||
|
||||
Example Playbooks
|
||||
-----------------
|
||||
|
||||
Working functional playbook examples can be found in the **`molecule/common`** directory in the following files:
|
||||
|
||||
- **[molecule/common/playbooks/default_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/master/molecule/common/playbooks/default_converge.yml):** Install a specific version of NGINX and set up logrotate
|
||||
- **[molecule/common/playbooks/module_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/master/molecule/common/playbooks/module_converge.yml):** Install various NGINX supported modules
|
||||
- **[molecule/common/playbooks/source_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/master/molecule/common/playbooks/source_converge.yml):** Install NGINX from source
|
||||
- **[molecule/common/playbooks/stable_push_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/master/molecule/common/playbooks/stable_push_converge.yml):** Install NGINX using the stable branch and push a preexisting config from your system to your NGINX instance
|
||||
- **[molecule/common/playbooks/template_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/master/molecule/common/playbooks/template_converge.yml):** Use the NGINX configuration templating variables to create an NGINX configuration file
|
||||
- **[molecule/common/playbooks/unit_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/master/molecule/common/playbooks/unit_converge.yml):** Install NGINX Unit
|
||||
- **[molecule/common/playbooks/default_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/common/playbooks/default_converge.yml):** Install a specific version of NGINX and set up logrotate
|
||||
- **[molecule/common/playbooks/module_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/common/playbooks/module_converge.yml):** Install various NGINX supported modules
|
||||
- **[molecule/common/playbooks/source_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/common/playbooks/source_converge.yml):** Install NGINX from source
|
||||
- **[molecule/common/playbooks/stable_push_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/common/playbooks/stable_push_converge.yml):** Install NGINX using the stable branch and push a preexisting config from your system to your NGINX instance
|
||||
- **[molecule/common/playbooks/template_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/common/playbooks/template_converge.yml):** Use the NGINX configuration templating variables to create an NGINX configuration file
|
||||
- **[molecule/common/playbooks/unit_converge.yml](https://github.com/nginxinc/ansible-role-nginx/blob/main/molecule/common/playbooks/unit_converge.yml):** Install NGINX Unit
|
||||
|
||||
Do note that if you install this repository via Ansible Galaxy, you will have to replace the role variable in the sample playbooks from `ansible-role-nginx` to `nginxinc.nginx`.
|
||||
|
||||
@ -202,7 +202,7 @@ You can find an Ansible role to install NGINX Unit [here](https://github.com/ngi
|
||||
License
|
||||
-------
|
||||
|
||||
[Apache License, Version 2.0](https://github.com/nginxinc/ansible-role-nginx/blob/master/LICENSE)
|
||||
[Apache License, Version 2.0](https://github.com/nginxinc/ansible-role-nginx/blob/main/LICENSE)
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
31
molecule/common/playbooks/plus_converge.yml
Normal file
31
molecule/common/playbooks/plus_converge.yml
Normal file
@ -0,0 +1,31 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
tasks:
|
||||
- name: Install NGINX
|
||||
include_role:
|
||||
name: ansible-role-nginx
|
||||
vars:
|
||||
nginx_type: plus
|
||||
nginx_license:
|
||||
certificate: ../../ansible-role-nginx/files/license/nginx-repo.crt
|
||||
key: ../../ansible-role-nginx/files/license/nginx-repo.key
|
||||
nginx_modules:
|
||||
- auth-spnego
|
||||
- brotli
|
||||
- cookie-flag
|
||||
- encrypted-session
|
||||
- geoip
|
||||
- geoip2
|
||||
- headers-more
|
||||
- image-filter
|
||||
- lua
|
||||
- modsecurity
|
||||
- njs
|
||||
- opentracing
|
||||
- passenger
|
||||
- perl
|
||||
- prometheus
|
||||
- rtmp
|
||||
- subs-filter
|
||||
- xslt
|
17
molecule/common/playbooks/plus_verify.yml
Normal file
17
molecule/common/playbooks/plus_verify.yml
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
- name: Verify
|
||||
hosts: all
|
||||
tasks:
|
||||
- name: Check if NGINX service is running
|
||||
service:
|
||||
name: nginx
|
||||
state: started
|
||||
enabled: yes
|
||||
check_mode: yes
|
||||
register: service
|
||||
failed_when: (service is changed) or (service is failed)
|
||||
|
||||
- name: Verify NGINX is up and running
|
||||
uri:
|
||||
url: http://localhost
|
||||
status_code: 200
|
48
molecule/plus/molecule.yml
Normal file
48
molecule/plus/molecule.yml
Normal file
@ -0,0 +1,48 @@
|
||||
---
|
||||
driver:
|
||||
name: docker
|
||||
lint: |
|
||||
set -e
|
||||
yamllint .
|
||||
ansible-lint --force-color
|
||||
platforms:
|
||||
- name: debian-stretch
|
||||
image: debian:stretch-slim
|
||||
dockerfile: ../common/Dockerfile.j2
|
||||
privileged: true
|
||||
volumes:
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
|
||||
command: "/sbin/init"
|
||||
- name: debian-buster
|
||||
image: debian:buster-slim
|
||||
dockerfile: ../common/Dockerfile.j2
|
||||
privileged: true
|
||||
volumes:
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
|
||||
command: "/sbin/init"
|
||||
- name: ubuntu-xenial
|
||||
image: ubuntu:xenial
|
||||
dockerfile: ../common/Dockerfile.j2
|
||||
privileged: true
|
||||
volumes:
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
|
||||
command: "/sbin/init"
|
||||
- name: ubuntu-bionic
|
||||
image: ubuntu:bionic
|
||||
dockerfile: ../common/Dockerfile.j2
|
||||
privileged: true
|
||||
volumes:
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
|
||||
command: "/sbin/init"
|
||||
- name: ubuntu-focal
|
||||
image: ubuntu:focal
|
||||
dockerfile: ../common/Dockerfile.j2
|
||||
privileged: true
|
||||
volumes:
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
|
||||
command: "/sbin/init"
|
||||
provisioner:
|
||||
name: ansible
|
||||
playbooks:
|
||||
converge: ../common/playbooks/plus_converge.yml
|
||||
verify: ../common/playbooks/plus_verify.yml
|
41
molecule/plus_alpine/molecule.yml
Normal file
41
molecule/plus_alpine/molecule.yml
Normal file
@ -0,0 +1,41 @@
|
||||
---
|
||||
driver:
|
||||
name: docker
|
||||
lint: |
|
||||
set -e
|
||||
yamllint .
|
||||
ansible-lint --force-color
|
||||
platforms:
|
||||
- name: alpine-3.8
|
||||
image: alpine:3.8
|
||||
dockerfile: ../common/Dockerfile.j2
|
||||
privileged: true
|
||||
volumes:
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
|
||||
command: "/sbin/init"
|
||||
- name: alpine-3.9
|
||||
image: alpine:3.9
|
||||
dockerfile: ../common/Dockerfile.j2
|
||||
privileged: true
|
||||
volumes:
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
|
||||
command: "/sbin/init"
|
||||
- name: alpine-3.10
|
||||
image: python:alpine3.10
|
||||
dockerfile: ../common/Dockerfile.j2
|
||||
privileged: true
|
||||
volumes:
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
|
||||
command: "/sbin/init"
|
||||
- name: alpine-3.11
|
||||
image: python:alpine3.11
|
||||
dockerfile: ../common/Dockerfile.j2
|
||||
privileged: true
|
||||
volumes:
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
|
||||
command: "/sbin/init"
|
||||
provisioner:
|
||||
name: ansible
|
||||
playbooks:
|
||||
converge: ../common/playbooks/plus_converge.yml
|
||||
verify: ../common/playbooks/plus_verify.yml
|
30
molecule/plus_centos/molecule.yml
Normal file
30
molecule/plus_centos/molecule.yml
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
driver:
|
||||
name: docker
|
||||
lint: |
|
||||
set -e
|
||||
yamllint .
|
||||
ansible-lint --force-color
|
||||
platforms:
|
||||
- name: centos-6
|
||||
image: centos:6
|
||||
dockerfile: ../common/Dockerfile.j2
|
||||
- name: centos-7
|
||||
image: centos:7
|
||||
dockerfile: ../common/Dockerfile.j2
|
||||
privileged: true
|
||||
volumes:
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
|
||||
command: "/usr/sbin/init"
|
||||
- name: centos-8
|
||||
image: centos:8
|
||||
dockerfile: ../common/Dockerfile.j2
|
||||
privileged: true
|
||||
volumes:
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
|
||||
command: "/usr/sbin/init"
|
||||
provisioner:
|
||||
name: ansible
|
||||
playbooks:
|
||||
converge: ../common/playbooks/plus_converge.yml
|
||||
verify: ../common/playbooks/plus_verify.yml
|
Loading…
Reference in New Issue
Block a user