Created
February 5, 2019 07:53
-
-
Save boonchu/d0e4e28ef11ea8cb1e8c90c9bf6f3d1f to your computer and use it in GitHub Desktop.
nginx_playbook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- 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