Skip to content

Instantly share code, notes, and snippets.

@boonchu
Created February 5, 2019 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boonchu/d0e4e28ef11ea8cb1e8c90c9bf6f3d1f to your computer and use it in GitHub Desktop.
Save boonchu/d0e4e28ef11ea8cb1e8c90c9bf6f3d1f to your computer and use it in GitHub Desktop.
nginx_playbook
---
- hosts: localhost
connection: local
gather_facts: True
become: yes
become_user: root
vars:
nginx_user: "www-data"
nginx_sites:
docker:
- listen 80
- server_name _
- location /v1 {
rewrite /v1/(.*) /$1 break;
proxy_pass http://localhost:8080;
proxy_redirect off;
proxy_set_header Host $host; }
pre_tasks:
- name: Updating apt.
apt:
update_cache: yes
- name: Installing NGINX package.
apt:
name: "{{ item }}"
state: present
with_items:
- nginx
roles:
- jdauphant.nginx
post_tasks:
- name: Verify output.
command: curl localhost/v1/books
register: out
- debug: var=out.stdout_lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment