Skip to content

Instantly share code, notes, and snippets.

@alexcheng1982
Created December 20, 2017 21:01
Show Gist options
  • Save alexcheng1982/9e2c4672e41d870df9988c83560f3034 to your computer and use it in GitHub Desktop.
Save alexcheng1982/9e2c4672e41d870df9988c83560f3034 to your computer and use it in GitHub Desktop.
Ansible task to setup Nginx on Windows
---
- name: install nginx
win_chocolatey:
name: nginx
state: present
- name: install nssm
win_chocolatey:
name: nssm
state: present
- name: copy nginx conf file
win_template:
src: nginx.conf.j2
dest: C:\ProgramData\chocolatey\lib\nginx\tools\nginx-1.12.1\conf\nginx.conf
- name: install nginx as service
win_nssm:
name: nginx
application: C:\ProgramData\chocolatey\lib\nginx\tools\nginx-1.12.1\nginx.exe
app_parameters_free_form: -c C:\ProgramData\chocolatey\lib\nginx\tools\nginx-1.12.1\conf\nginx.conf -p C:\ProgramData\chocolatey\lib\nginx\tools\nginx-1.12.1
stdout_file: C:\nginx_out.txt
stderr_file: C:\nginx_error.txt
start_mode: auto
state: started
notify:
- start nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment