lexa-uw.nginx-configuration
Nginx Config Change Role
This role allows you to modify the Nginx configuration and revert the changes if something goes wrong.
Requirements
You need Ansible version 2.5 or higher to use this role.
Role Variables
nginx_config_src
:
The path to your Nginx configuration file. This is mandatory.
nginx_config_dest
:
The path where the configuration will be saved on the server. (Default: /etc/nginx/conf.d/nginx.conf).
nginx_command_to_check_config
:
The command to verify the Nginx configuration. (Default: nginx -t).
nginx_command_to_reload
:
The command to reload the server. (Default: service nginx reload).
Adding the Role to Your Project:
You can add this role to your requirements file (like requirements.yml):
- src: lexa-uw.nginx-configuration
version: v1.0.0
name: nginx-configuration
To install the role, run: ansible-galaxy install -r ./requirements.yml --roles-path ./roles/
Example Playbook:
- hosts: all
vars_files:
- vars/main.yml
roles:
- { role: nginx-configuration }
In vars/main.yml
, you can set:
nginx_config_src: templates/example.conf
nginx_config_dest: /etc/nginx/conf.d/example.conf
nginx_command_to_reload: /etc/init.d/nginx reload