lexa-uw.nginx-configuration
更改 nginx 配置的角色
使用此角色,您可以更改 nginx 配置并在出现问题时回滚。
要求
此角色需要 Ansible 2.5 或更高版本。
角色变量
nginx_config_src
您的 nginx 配置文件路径。必填选项。
nginx_config_dest
配置在服务器上存储的路径。 (默认: /etc/nginx/conf.d/nginx.conf)
nginx_command_to_check_config
检查 nginx 配置的命令。 (默认: nginx -t)
nginx_command_to_reload
重新加载服务器的命令。 (默认: service nginx reload)
将角色添加到项目:
将角色添加到您的需求文件(例如 _requirements.yml_):
- src: lexa-uw.nginx-configuration
version: v1.0.0
name: nginx-configuration
安装角色:ansible-galaxy install -r ./requirements.yml --roles-path ./roles/
剧本示例:
- hosts: all
vars_files:
- vars/main.yml
roles:
- { role: nginx-configuration }
在 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