Role to deploy a Docker container with Openresty.
Includes opt-in config for rate limiting, Prometheus metrics and default proxy config.
- name: Deploy Openresty
hosts: localhost
vars:
ansible_become: true
tasks:
- name: Create a network
docker_network:
name: test_default
- import_role:
name: ansible-role-openresty
vars:
openresty_includes_extras:
findwork-dev.conf: |
server {
server myserver.org;
location / {
set $proxy_address mycontainer:5050;
proxy_pass http://$proxy_address;
}
}
openresty_includes_builtin:
- proxy.conf
- rate_limit.conf
- prometheus_metrics.conf
openresty_docker_networks:
- name: test_default
For running Openresty with auto SSL the following additions are needed:
- name: Deploy Openresty
hosts: localhost
become: true
tasks:
- name: Create a network
docker_network:
name: test_default
- import_role:
name: ansible-openresty
vars:
openresty_includes_extras:
findwork-dev.conf: |
server {
listen 443 ssl;
server_name findwork.dev;
{{ openresty_auto_ssl_config|indent(2) }}
location / {
set $proxy_address mycontainer:5050;
proxy_pass http://$proxy_address;
}
}
openresty_includes_builtin:
- ssl.conf
- proxy.conf
- logging.conf
openresty_ssl_domains:
- findwork.dev
openresty_docker_networks:
- name: test_default
Proxy.conf will include the docker dns resolver 127.0.0.11 which requires a user defined network.
This role will check the configuration so ensure you use variables when using proxy_pass otherwise the host will not be found.
location / {
set $proxy_address myserver:5050;
proxy_pass http://$proxy_address;
}
pip install dockerContent type
Image
Digest
Size
117.1 MB
Last updated
over 5 years ago
docker pull danihodovic/openresty