With this role you can change nginx config and roll it back if something went wrong.
This role requires Ansible 2.5 or higher.
nginx_config_src
Path to your nginx config file. Required option.
nginx_config_dest
Path where config must be stored on server. (default: /etc/nginx/conf.d/nginx.conf).
nginx_command_to_check_config
Command to check nginx configuration. (default: nginx -t)
nginx_command_to_reload
Command to reload server. (default: service nginx reload)
Add role into your requirements(requirements.yml for example):
- src: lexa-uw.nginx-configuration
version: v1.0.0
name: nginx-configuration
Install role: ansible-galaxy install -r ./requirements.yml --roles-path ./roles/
- hosts: all
vars_files:
- vars/main.yml
roles:
- { role: nginx-configuration }
Inside vars/main.yml
nginx_config_src: templates/example.conf
nginx_config_dest: /etc/nginx/conf.d/example.conf
nginx_command_to_reload: /etc/init.d/nginx reload