alecunsolo.nginx
Ansible Role: nginx
DISCLAIMER
After this announcement I will not test on RHEL anymore.
Ansible role to install and configure nginx. Site definitions are stored in the /etc/nginx/conf.d directory and can be managed by this role.
Requirements
None.
Role Variables
nginx_main_config: nginx.{{ ansible_os_family | lower }}.conf
The name of the main configuration template file.
nginx_static_files:
- src: proxy_params
dest: proxy_params
List of common files to deploy (dest directory partent is /etc/nginx)
nginx_manage_selinux: true
Whether to enable httpd_can_network_connect on SELinux enabled systems.
nginx_exclusive_sites: true
Whether the role should take full controll of the configured sites (deleting undefinded files) or not.
nginx_configured_sites: []
# - src: mysite.conf.j2
# dest: conf.d/mysite.conf
List of site definition to be deployed. Any site not listed here will be deleted (minus the default rejection one, if the option is enabled).
Dependencies
The role also need ansible.posix for SELinux related operations.
Example Playbook
- name: Converge
hosts: all
vars:
nginx_configured_sites:
- src: mysite.conf.j2
dest: conf.d/mysite.conf
tasks:
- name: Include nginx.
ansible.builtin.include_role:
name: alecunsolo.nginx
License
MIT
Notes
Testing with molecule is stolen from heavily inspired by Jeff Geerling. Watch his video (and the other ones as well).
ansible-galaxy install alecunsolo.nginx